-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #623 from allevato/5.9-features-in-5.9
[5.9 🍒] Add support for various new 5.9 features.
- Loading branch information
Showing
9 changed files
with
161 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
final class ConsumeExprTests: PrettyPrintTestCase { | ||
func testConsume() { | ||
assertPrettyPrintEqual( | ||
input: """ | ||
let x = consume y | ||
""", | ||
expected: """ | ||
let x = | ||
consume y | ||
""", | ||
linelength: 16) | ||
} | ||
} |
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,14 @@ | ||
final class CopyExprTests: PrettyPrintTestCase { | ||
func testCopy() { | ||
assertPrettyPrintEqual( | ||
input: """ | ||
let x = copy y | ||
""", | ||
expected: """ | ||
let x = | ||
copy y | ||
""", | ||
linelength: 13) | ||
} | ||
} |
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,13 @@ | ||
final class DiscardStmtTests: PrettyPrintTestCase { | ||
func testDiscard() { | ||
assertPrettyPrintEqual( | ||
input: """ | ||
discard self | ||
""", | ||
expected: """ | ||
discard self | ||
""", | ||
linelength: 9) | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
Tests/SwiftFormatTests/PrettyPrint/ParameterPackTests.swift
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,46 @@ | ||
final class ParameterPackTests: PrettyPrintTestCase { | ||
func testGenericPackArgument() { | ||
assertPrettyPrintEqual( | ||
input: """ | ||
func someFunction<each P>() {} | ||
struct SomeStruct<each P> {} | ||
""", | ||
expected: """ | ||
func someFunction< | ||
each P | ||
>() {} | ||
struct SomeStruct< | ||
each P | ||
> {} | ||
""", | ||
linelength: 22) | ||
} | ||
|
||
func testPackExpansionsAndElements() { | ||
assertPrettyPrintEqual( | ||
input: """ | ||
repeat checkNilness(of: each value) | ||
""", | ||
expected: """ | ||
repeat checkNilness( | ||
of: each value) | ||
""", | ||
linelength: 25) | ||
|
||
assertPrettyPrintEqual( | ||
input: """ | ||
repeat f(of: each v) | ||
""", | ||
expected: """ | ||
repeat | ||
f( | ||
of: | ||
each v | ||
) | ||
""", | ||
linelength: 7) | ||
} | ||
} |
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