Skip to content

Commit 3cd9dfa

Browse files
committed
Refine types in builder interpolation tests
1 parent 1c8883a commit 3cd9dfa

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

Tests/SwiftSyntaxBuilderTest/StringInterpolation.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,32 +108,32 @@ final class StringInterpolationTests: XCTestCase {
108108
}
109109

110110
func testInterpolationLiteralString() {
111-
let a: SourceFileSyntax = "print(\(literal: "Hello, world!"))"
111+
let a: ExprSyntax = "print(\(literal: "Hello, world!"))"
112112
AssertStringsEqualWithDiff(a.description, #"print("Hello, world!")"#)
113113

114-
let b: SourceFileSyntax = "print(\(literal: "\"Hello\", world!"))"
114+
let b: ExprSyntax = "print(\(literal: "\"Hello\", world!"))"
115115
AssertStringsEqualWithDiff(b.description, ##"print(#""Hello", world!"#)"##)
116116

117-
let c: SourceFileSyntax = "print(\(literal: "Hello\\#\\world!"))"
117+
let c: ExprSyntax = "print(\(literal: "Hello\\#\\world!"))"
118118
AssertStringsEqualWithDiff(c.description, ###"print(##"Hello\#\world!"##)"###)
119119

120-
let d: SourceFileSyntax = "print(\(literal: "Hello, world!\n"))"
120+
let d: ExprSyntax = "print(\(literal: "Hello, world!\n"))"
121121
AssertStringsEqualWithDiff(d.description, #"print("Hello, world!\n")"#)
122122

123-
let e: SourceFileSyntax = "print(\(literal: "\"Hello\", world!\n"))"
123+
let e: ExprSyntax = "print(\(literal: "\"Hello\", world!\n"))"
124124
AssertStringsEqualWithDiff(e.description, ##"print(#""Hello", world!\#n"#)"##)
125125
}
126126

127127
func testInterpolationLiteralInt() {
128128
func test<T: ExpressibleByIntegerLiteral & ExpressibleByLiteralSyntax>(with ty: T.Type, unsigned: Bool = false) {
129-
let a: SourceFileSyntax = "print(\(literal: 42 as T))"
129+
let a: ExprSyntax = "print(\(literal: 42 as T))"
130130
AssertStringsEqualWithDiff(a.description, #"print(42)"#, additionalInfo: String(describing: ty))
131131

132-
let b: SourceFileSyntax = "print(\(literal: 0 as T))"
132+
let b: ExprSyntax = "print(\(literal: 0 as T))"
133133
AssertStringsEqualWithDiff(b.description, #"print(0)"#, additionalInfo: String(describing: ty))
134134

135135
if !unsigned {
136-
let c: SourceFileSyntax = "print(\(literal: -42 as T))"
136+
let c: ExprSyntax = "print(\(literal: -42 as T))"
137137
AssertStringsEqualWithDiff(c.description, ##"print(-42)"##, additionalInfo: String(describing: ty))
138138
}
139139
}
@@ -152,28 +152,28 @@ final class StringInterpolationTests: XCTestCase {
152152

153153
func testInterpolationLiteralFloat() {
154154
func test<T: FloatingPoint & ExpressibleByFloatLiteral & ExpressibleByLiteralSyntax>(with ty: T.Type) {
155-
let a: SourceFileSyntax = "print(\(literal: 3.14 as T))"
155+
let a: ExprSyntax = "print(\(literal: 3.14 as T))"
156156
AssertStringsEqualWithDiff(a.description, #"print(3.14)"#, additionalInfo: String(describing: ty))
157157

158-
let b: SourceFileSyntax = "print(\(literal: 0 as T))"
158+
let b: ExprSyntax = "print(\(literal: 0 as T))"
159159
AssertStringsEqualWithDiff(b.description, #"print(0.0)"#, additionalInfo: String(describing: ty))
160160

161-
let c: SourceFileSyntax = "print(\(literal: -42 as T))"
161+
let c: ExprSyntax = "print(\(literal: -42 as T))"
162162
AssertStringsEqualWithDiff(c.description, ##"print(-42.0)"##, additionalInfo: String(describing: ty))
163163

164-
let d: SourceFileSyntax = "print(\(literal: T.infinity))"
164+
let d: ExprSyntax = "print(\(literal: T.infinity))"
165165
AssertStringsEqualWithDiff(d.description, ##"print(.infinity)"##, additionalInfo: String(describing: ty))
166166

167-
let e: SourceFileSyntax = "print(\(literal: -T.infinity))"
167+
let e: ExprSyntax = "print(\(literal: -T.infinity))"
168168
AssertStringsEqualWithDiff(e.description, ##"print(-.infinity)"##, additionalInfo: String(describing: ty))
169169

170-
let f: SourceFileSyntax = "print(\(literal: T.nan))"
170+
let f: ExprSyntax = "print(\(literal: T.nan))"
171171
AssertStringsEqualWithDiff(f.description, ##"print(.nan)"##, additionalInfo: String(describing: ty))
172172

173-
let g: SourceFileSyntax = "print(\(literal: T.signalingNaN))"
173+
let g: ExprSyntax = "print(\(literal: T.signalingNaN))"
174174
AssertStringsEqualWithDiff(g.description, ##"print(.signalingNaN)"##, additionalInfo: String(describing: ty))
175175

176-
let h: SourceFileSyntax = "print(\(literal: -0.0 as T))"
176+
let h: ExprSyntax = "print(\(literal: -0.0 as T))"
177177
AssertStringsEqualWithDiff(h.description, ##"print(-0.0)"##, additionalInfo: String(describing: ty))
178178
}
179179

@@ -182,24 +182,24 @@ final class StringInterpolationTests: XCTestCase {
182182
}
183183

184184
func testInterpolationLiteralBool() {
185-
let a: SourceFileSyntax = "print(\(literal: true))"
185+
let a: ExprSyntax = "print(\(literal: true))"
186186
AssertStringsEqualWithDiff(a.description, #"print(true)"#)
187187

188-
let b: SourceFileSyntax = "print(\(literal: false))"
188+
let b: ExprSyntax = "print(\(literal: false))"
189189
AssertStringsEqualWithDiff(b.description, #"print(false)"#)
190190
}
191191

192192
func testInterpolationLiteralCollections() {
193-
let a: SourceFileSyntax = "print(\(literal: [3, 2, 1]))"
193+
let a: ExprSyntax = "print(\(literal: [3, 2, 1]))"
194194
AssertStringsEqualWithDiff(a.description, #"print([3, 2, 1])"#)
195195

196-
let b: SourceFileSyntax = "print(\(literal: [3, 2, 1] as Set))"
196+
let b: ExprSyntax = "print(\(literal: [3, 2, 1] as Set))"
197197
AssertStringsEqualWithDiff(b.description, #"print([1, 2, 3])"#)
198198

199-
let c: SourceFileSyntax = "print(\(literal: [3: "three", 2: "two", 1: "one"] as KeyValuePairs))"
199+
let c: ExprSyntax = "print(\(literal: [3: "three", 2: "two", 1: "one"] as KeyValuePairs))"
200200
AssertStringsEqualWithDiff(c.description, #"print([3: "three", 2: "two", 1: "one"])"#)
201201

202-
let d: SourceFileSyntax = "print(\(literal: [3: "three", 2: "two", 1: "one"]))"
202+
let d: ExprSyntax = "print(\(literal: [3: "three", 2: "two", 1: "one"]))"
203203
AssertStringsEqualWithDiff(d.description, #"print([1: "one", 2: "two", 3: "three"])"#)
204204
}
205205

0 commit comments

Comments
 (0)