File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ extension VersionTuple {
2727 components = [ ]
2828
2929 // Version value are separated by periods.
30- let componentStrings = versionString. split ( separator: " . " )
30+ let componentStrings = versionString. split ( separator: " . " , omittingEmptySubsequences : false )
3131
3232 /// Record a component after checking its value.
3333 func recordComponent( _ value: Int ) throws {
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ public struct VersionTuple: Sendable {
3333 public init ? ( parsing string: String ) {
3434 self . components = [ ]
3535
36- for componentText in string. split ( separator: " . " ) {
36+ for componentText in string. split ( separator: " . " , omittingEmptySubsequences : false ) {
3737 guard let component = Int ( componentText) else {
3838 return nil
3939 }
Original file line number Diff line number Diff line change @@ -176,6 +176,17 @@ public class EvaluateTests: XCTestCase {
176176 assertIfConfig ( " swift(>=5.5) " , . active)
177177 assertIfConfig ( " swift(<6) " , . active)
178178 assertIfConfig ( " swift(>=6) " , . unparsed)
179+ assertIfConfig (
180+ " swift(>=...) " ,
181+ . unparsed,
182+ diagnostics: [
183+ DiagnosticSpec (
184+ message: " 'swift' version check has invalid version '' " ,
185+ line: 1 ,
186+ column: 9
187+ )
188+ ]
189+ )
179190 assertIfConfig ( " compiler(>=5.8) " , . active)
180191 assertIfConfig ( " compiler(>=5.9) " , . active)
181192 assertIfConfig ( " compiler(>=5.10) " , . unparsed)
@@ -206,6 +217,17 @@ public class EvaluateTests: XCTestCase {
206217 )
207218 ]
208219 )
220+ assertIfConfig (
221+ #"_compiler_version("...")"# ,
222+ . unparsed,
223+ diagnostics: [
224+ DiagnosticSpec (
225+ message: " found empty version component " ,
226+ line: 1 ,
227+ column: 20
228+ )
229+ ]
230+ )
209231 }
210232
211233 func testCanImport( ) throws {
You can’t perform that action at this time.
0 commit comments