Skip to content

Commit 78f41cf

Browse files
committed
[SwiftFormat] Applied formatting
1 parent a1a517f commit 78f41cf

2 files changed

Lines changed: 88 additions & 88 deletions

File tree

Tests/PrincipleMacrosTests/Syntax/Extensions/ClassDeclSyntaxTests.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ internal enum ClassDeclSyntaxTests {
3434
@Test
3535
func withOverrideModifier() throws {
3636
let decl: DeclSyntax = """
37-
class MyClass: BaseClass<Int>, Hashable {
38-
override func test() {}
39-
}
40-
"""
37+
class MyClass: BaseClass<Int>, Hashable {
38+
override func test() {}
39+
}
40+
"""
4141

4242
let classDecl = try #require(decl.as(ClassDeclSyntax.self))
4343
let inferredSuperclass = classDecl.inferredSuperclassType()
@@ -47,12 +47,12 @@ internal enum ClassDeclSyntaxTests {
4747
@Test
4848
func withSuperExpression() throws {
4949
let decl: DeclSyntax = """
50-
class MyClass: BaseClass, Hashable {
51-
init(value: Int) {
52-
super.init()
50+
class MyClass: BaseClass, Hashable {
51+
init(value: Int) {
52+
super.init()
53+
}
5354
}
54-
}
55-
"""
55+
"""
5656

5757
let classDecl = try #require(decl.as(ClassDeclSyntax.self))
5858
let inferredSuperclass = classDecl.inferredSuperclassType()
@@ -62,12 +62,12 @@ internal enum ClassDeclSyntaxTests {
6262
@Test
6363
func withNestedClass() throws {
6464
let decl: DeclSyntax = """
65-
class MyClass: Equatable, Hashable {
66-
class NestedClass: BaseClass {
67-
override func test() {}
65+
class MyClass: Equatable, Hashable {
66+
class NestedClass: BaseClass {
67+
override func test() {}
68+
}
6869
}
69-
}
70-
"""
70+
"""
7171

7272
let classDecl = try #require(decl.as(ClassDeclSyntax.self))
7373
let inferredSuperclass = classDecl.inferredSuperclassType()

Tests/PrincipleMacrosTests/Syntax/Extensions/IfConfigDeclSyntaxTests.swift

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Testing
1212
internal enum IfConfigDeclSyntaxTests {
1313

1414
struct EnclosingIfConfig {
15-
15+
1616
private func parseLastProperty(in decl: DeclSyntax) throws -> Property {
1717
let classDecl = try #require(decl.as(ClassDeclSyntax.self))
1818
let properties = try PropertiesParser.parse(memberBlock: classDecl.memberBlock)
@@ -24,10 +24,10 @@ internal enum IfConfigDeclSyntaxTests {
2424
@Test
2525
func withoutIfConfig() throws {
2626
let decl: DeclSyntax = """
27-
class MyClass {
28-
var test = 123
29-
}
30-
"""
27+
class MyClass {
28+
var test = 123
29+
}
30+
"""
3131

3232
let ifConfig = try parseLastProperty(in: decl).enclosingIfConfig
3333
#expect(ifConfig == nil)
@@ -36,19 +36,19 @@ internal enum IfConfigDeclSyntaxTests {
3636
@Test
3737
func withIfConfig() throws {
3838
let decl: DeclSyntax = """
39-
class MyClass {
39+
class MyClass {
40+
#if os(macOS)
41+
var other = "hello"
42+
var test = 123
43+
#endif
44+
}
45+
"""
46+
47+
let expectation = """
4048
#if os(macOS)
41-
var other = "hello"
4249
var test = 123
4350
#endif
44-
}
45-
"""
46-
47-
let expectation = """
48-
#if os(macOS)
49-
var test = 123
50-
#endif
51-
"""
51+
"""
5252

5353
let ifConfig = try parseLastProperty(in: decl).enclosingIfConfig
5454
#expect(ifConfig?.description == expectation)
@@ -57,21 +57,21 @@ internal enum IfConfigDeclSyntaxTests {
5757
@Test
5858
func withElseIfConfig() throws {
5959
let decl: DeclSyntax = """
60-
class MyClass {
60+
class MyClass {
61+
#if os(iOS)
62+
var other = "hello"
63+
#elseif os(macOS)
64+
var test = 123
65+
#endif
66+
}
67+
"""
68+
69+
let expectation = """
6170
#if os(iOS)
62-
var other = "hello"
6371
#elseif os(macOS)
6472
var test = 123
6573
#endif
66-
}
67-
"""
68-
69-
let expectation = """
70-
#if os(iOS)
71-
#elseif os(macOS)
72-
var test = 123
73-
#endif
74-
"""
74+
"""
7575

7676
let ifConfig = try parseLastProperty(in: decl).enclosingIfConfig
7777
#expect(ifConfig?.description == expectation)
@@ -80,23 +80,23 @@ internal enum IfConfigDeclSyntaxTests {
8080
@Test
8181
func withNestedIfConfig() throws {
8282
let decl: DeclSyntax = """
83-
class MyClass {
83+
class MyClass {
84+
#if DEBUG
85+
var other = "hello"
86+
#if os(macOS)
87+
var test = 123
88+
#endif
89+
#endif
90+
}
91+
"""
92+
93+
let expectation = """
8494
#if DEBUG
85-
var other = "hello"
8695
#if os(macOS)
8796
var test = 123
8897
#endif
8998
#endif
90-
}
91-
"""
92-
93-
let expectation = """
94-
#if DEBUG
95-
#if os(macOS)
96-
var test = 123
97-
#endif
98-
#endif
99-
"""
99+
"""
100100

101101
let ifConfig = try parseLastProperty(in: decl).enclosingIfConfig
102102
#expect(ifConfig?.description == expectation)
@@ -105,25 +105,25 @@ internal enum IfConfigDeclSyntaxTests {
105105
@Test
106106
func withNestedElseConfig() throws {
107107
let decl: DeclSyntax = """
108-
class MyClass {
109-
#if DEBUG
110-
var other = "hello"
111-
#else
112-
#if os(macOS)
113-
var test = 123
108+
class MyClass {
109+
#if DEBUG
110+
var other = "hello"
111+
#else
112+
#if os(macOS)
113+
var test = 123
114+
#endif
114115
#endif
115-
#endif
116-
}
117-
"""
116+
}
117+
"""
118118

119119
let expectation = """
120-
#if DEBUG
121-
#else
122-
#if os(macOS)
123-
var test = 123
124-
#endif
125-
#endif
126-
"""
120+
#if DEBUG
121+
#else
122+
#if os(macOS)
123+
var test = 123
124+
#endif
125+
#endif
126+
"""
127127

128128
let ifConfig = try parseLastProperty(in: decl).enclosingIfConfig
129129
#expect(ifConfig?.description == expectation)
@@ -132,31 +132,31 @@ internal enum IfConfigDeclSyntaxTests {
132132
@Test
133133
func applyToNewMembers() throws {
134134
let decl: DeclSyntax = """
135-
class MyClass {
136-
#if DEBUG
137-
var other = "hello"
138-
#else
139-
#if os(macOS)
140-
var test = 123
135+
class MyClass {
136+
#if DEBUG
137+
var other = "hello"
138+
#else
139+
#if os(macOS)
140+
var test = 123
141+
#endif
141142
#endif
142-
#endif
143-
}
144-
"""
143+
}
144+
"""
145145

146146
let newMembers: MemberBlockItemListSyntax = """
147-
var replacement = "Hello"
148-
func test() {}
149-
"""
147+
var replacement = "Hello"
148+
func test() {}
149+
"""
150150

151151
let expectation = """
152-
#if DEBUG
153-
#else
154-
#if os(macOS)
155-
var replacement = "Hello"
156-
func test() {}
157-
#endif
158-
#endif
159-
"""
152+
#if DEBUG
153+
#else
154+
#if os(macOS)
155+
var replacement = "Hello"
156+
func test() {}
157+
#endif
158+
#endif
159+
"""
160160

161161
let property = try parseLastProperty(in: decl)
162162
let ifConfig = property.underlying.applyingEnclosingIfConfig(to: newMembers)

0 commit comments

Comments
 (0)