-
-
Notifications
You must be signed in to change notification settings - Fork 32
Fix three bugs found in a pre-release audit #534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,4 +29,15 @@ final class InsertionSafetyGateTests: XCTestCase { | |||||||||||||||||||||||||||||||
| func test_interiorControlCharacter_isUnsafe() { | ||||||||||||||||||||||||||||||||
| XCTAssertFalse(InsertionSafetyGate.isSafeToInsert("a\tb")) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| func test_multiLineContent_isSafe() { | ||||||||||||||||||||||||||||||||
| // A line feed is legitimate content in a multi-line completion, so it must pass (the previous | ||||||||||||||||||||||||||||||||
| // behavior rejected it, silently suppressing every multi-line completion). | ||||||||||||||||||||||||||||||||
| XCTAssertTrue(InsertionSafetyGate.isSafeToInsert("first line\nsecond line")) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| func test_newlineOnly_isUnsafe() { | ||||||||||||||||||||||||||||||||
| // Newlines are whitespace; a newline-only completion is still nothing worth inserting. | ||||||||||||||||||||||||||||||||
| XCTAssertFalse(InsertionSafetyGate.isSafeToInsert("\n\n")) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
43
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&&semantics with an infix||inside the second clause. The logic is correct, but a reader who doesn't notice that the comma binds looser than||could misread it as(scalar.value != 0x0A, scalar.value < 0x20) || scalar.value == 0x7F. Using&&with explicit parentheses makes the grouping unambiguous.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!