Skip to content

Commit 459c23f

Browse files
authored
Merge pull request #292 from allevato/constrained-sugar-tests
Add tests to cover `any` types in `ConstrainedSugarType` support.
2 parents c5bec02 + 7d8b20b commit 459c23f

File tree

2 files changed

+41
-11
lines changed

2 files changed

+41
-11
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
final class ConstrainedSugarTypeTests: PrettyPrintTestCase {
2+
func testSomeTypes() {
3+
let input =
4+
"""
5+
var body: some View
6+
func foo() -> some Foo
7+
"""
8+
9+
assertPrettyPrintEqual(input: input, expected: input + "\n", linelength: 25)
10+
11+
let expected11 =
12+
"""
13+
var body:
14+
some View
15+
func foo()
16+
-> some Foo
17+
18+
"""
19+
assertPrettyPrintEqual(input: input, expected: expected11, linelength: 11)
20+
}
21+
22+
func testAnyTypes() {
23+
let input =
24+
"""
25+
var body: any View
26+
func foo() -> any Foo
27+
"""
28+
29+
assertPrettyPrintEqual(input: input, expected: input + "\n", linelength: 25)
30+
31+
let expected11 =
32+
"""
33+
var body:
34+
any View
35+
func foo()
36+
-> any Foo
37+
38+
"""
39+
assertPrettyPrintEqual(input: input, expected: expected11, linelength: 11)
40+
}
41+
}

Tests/SwiftFormatPrettyPrintTests/SomeTypeTests.swift

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)