Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add spaces after labels for overlooked stmt types.
Some statement types that allow a label were lacking the space token after the label. This caused the formatter to remove spaces when it encountered those stmt types.
- Loading branch information
1 parent
428b33c
commit c7db906
Showing
6 changed files
with
171 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import SwiftFormatConfiguration | ||
|
||
final class DoStmtTests: PrettyPrintTestCase { | ||
func testBasicDoStmt() { | ||
let input = | ||
""" | ||
do {} | ||
do { f() } | ||
do { foo() } | ||
do { let a = 123 | ||
var b = "abc" | ||
} | ||
do { veryLongFunctionCallThatShouldBeBrokenOntoANewLine() } | ||
""" | ||
|
||
let expected = | ||
""" | ||
do {} | ||
do { f() } | ||
do { foo() } | ||
do { | ||
let a = 123 | ||
var b = "abc" | ||
} | ||
do { | ||
veryLongFunctionCallThatShouldBeBrokenOntoANewLine() | ||
} | ||
""" | ||
|
||
assertPrettyPrintEqual(input: input, expected: expected, linelength: 25) | ||
} | ||
|
||
func testLabeledDoStmt() { | ||
let input = """ | ||
someLabel:do { | ||
bar() | ||
baz() | ||
} | ||
somePrettyLongLabelThatTakesUpManyColumns: do { | ||
bar() | ||
baz() | ||
} | ||
""" | ||
|
||
let expected = """ | ||
someLabel: do { | ||
bar() | ||
baz() | ||
} | ||
somePrettyLongLabelThatTakesUpManyColumns: do | ||
{ | ||
bar() | ||
baz() | ||
} | ||
""" | ||
assertPrettyPrintEqual(input: input, expected: expected, linelength: 45) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters