Skip to content

Commit dad947a

Browse files
committed
Add test for canImport versions that aren't version tuples
1 parent a30e2dc commit dad947a

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Tests/SwiftIfConfigTest/EvaluateTests.swift

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ public class EvaluateTests: XCTestCase {
216216
assertIfConfig("canImport(SwiftSyntax, _version: 5.10)", .inactive)
217217
assertIfConfig(#"canImport(SwiftSyntax, _version: "5.9")"#, .active)
218218
assertIfConfig("canImport(SwiftSyntax, _underlyingVersion: 5009)", .active)
219-
assertIfConfig("canImport(SwiftSyntax, _underlyingVersion: 5009.10", .inactive)
219+
assertIfConfig("canImport(SwiftSyntax, _underlyingVersion: 5009.10)", .inactive)
220220
assertIfConfig(
221-
"canImport(SwiftSyntax, _underlyingVersion: 5009.10.5.4.2.3.5",
221+
"canImport(SwiftSyntax, _underlyingVersion: 5009.10.5.4.2.3.5)",
222222
.inactive,
223223
diagnostics: [
224224
DiagnosticSpec(
@@ -229,6 +229,30 @@ public class EvaluateTests: XCTestCase {
229229
)
230230
]
231231
)
232+
assertIfConfig(
233+
"canImport(SwiftSyntax, _version: 20A301)",
234+
.unparsed,
235+
diagnostics: [
236+
DiagnosticSpec(
237+
message: "'canImport' version check has invalid version '20A301'",
238+
line: 1,
239+
column: 34,
240+
severity: .error
241+
)
242+
]
243+
)
244+
assertIfConfig(
245+
#"canImport(SwiftSyntax, _version: "20A301")"#,
246+
.unparsed,
247+
diagnostics: [
248+
DiagnosticSpec(
249+
message: #"'canImport' version check has invalid version '"20A301"'"#,
250+
line: 1,
251+
column: 34,
252+
severity: .error
253+
)
254+
]
255+
)
232256
}
233257
}
234258

0 commit comments

Comments
 (0)