@@ -18,83 +18,83 @@ import XCTest
1818final class SemanticVersionTests : XCTestCase {
1919
2020 func test_semVerRegex_valid( ) throws {
21- XCTAssert ( semVerRegex . matches ( " 0.0.4 " ) )
22- XCTAssert ( semVerRegex . matches ( " 1.2.3 " ) )
23- XCTAssert ( semVerRegex . matches ( " 10.20.30 " ) )
24- XCTAssert ( semVerRegex . matches ( " 1.1.2-prerelease+meta " ) )
25- XCTAssert ( semVerRegex . matches ( " 1.1.2+meta " ) )
26- XCTAssert ( semVerRegex . matches ( " 1.1.2+meta-valid " ) )
27- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha " ) )
28- XCTAssert ( semVerRegex . matches ( " 1.0.0-beta " ) )
29- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha.beta " ) )
30- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha.beta.1 " ) )
31- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha.1 " ) )
32- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha0.valid " ) )
33- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha.0valid " ) )
34- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay " ) )
35- XCTAssert ( semVerRegex . matches ( " 1.0.0-rc.1+build.1 " ) )
36- XCTAssert ( semVerRegex . matches ( " 2.0.0-rc.1+build.123 " ) )
37- XCTAssert ( semVerRegex . matches ( " 1.2.3-beta " ) )
38- XCTAssert ( semVerRegex . matches ( " 10.2.3-DEV-SNAPSHOT " ) )
39- XCTAssert ( semVerRegex . matches ( " 1.2.3-SNAPSHOT-123 " ) )
40- XCTAssert ( semVerRegex . matches ( " 1.0.0 " ) )
41- XCTAssert ( semVerRegex . matches ( " 2.0.0 " ) )
42- XCTAssert ( semVerRegex . matches ( " 1.1.7 " ) )
43- XCTAssert ( semVerRegex . matches ( " 2.0.0+build.1848 " ) )
44- XCTAssert ( semVerRegex . matches ( " 2.0.1-alpha.1227 " ) )
45- XCTAssert ( semVerRegex . matches ( " 1.0.0-alpha+beta " ) )
46- XCTAssert ( semVerRegex . matches ( " 1.2.3----RC-SNAPSHOT.12.9.1--.12+788 " ) )
47- XCTAssert ( semVerRegex . matches ( " 1.2.3----R-S.12.9.1--.12+meta " ) )
48- XCTAssert ( semVerRegex . matches ( " 1.2.3----RC-SNAPSHOT.12.9.1--.12 " ) )
49- XCTAssert ( semVerRegex . matches ( " 1.0.0+0.build.1-rc.10000aaa-kk-0.1 " ) )
50- XCTAssert ( semVerRegex . matches ( " 99999999999999999999999.999999999999999999.99999999999999999 " ) )
51- XCTAssert ( semVerRegex . matches ( " 1.0.0-0A.is.legal " ) )
21+ XCTAssertNotNil ( " 0.0.4 " . wholeMatch ( of : semVerRegex ) )
22+ XCTAssertNotNil ( " 1.2.3 " . wholeMatch ( of : semVerRegex ) )
23+ XCTAssertNotNil ( " 10.20.30 " . wholeMatch ( of : semVerRegex ) )
24+ XCTAssertNotNil ( " 1.1.2-prerelease+meta " . wholeMatch ( of : semVerRegex ) )
25+ XCTAssertNotNil ( " 1.1.2+meta " . wholeMatch ( of : semVerRegex ) )
26+ XCTAssertNotNil ( " 1.1.2+meta-valid " . wholeMatch ( of : semVerRegex ) )
27+ XCTAssertNotNil ( " 1.0.0-alpha " . wholeMatch ( of : semVerRegex ) )
28+ XCTAssertNotNil ( " 1.0.0-beta " . wholeMatch ( of : semVerRegex ) )
29+ XCTAssertNotNil ( " 1.0.0-alpha.beta " . wholeMatch ( of : semVerRegex ) )
30+ XCTAssertNotNil ( " 1.0.0-alpha.beta.1 " . wholeMatch ( of : semVerRegex ) )
31+ XCTAssertNotNil ( " 1.0.0-alpha.1 " . wholeMatch ( of : semVerRegex ) )
32+ XCTAssertNotNil ( " 1.0.0-alpha0.valid " . wholeMatch ( of : semVerRegex ) )
33+ XCTAssertNotNil ( " 1.0.0-alpha.0valid " . wholeMatch ( of : semVerRegex ) )
34+ XCTAssertNotNil ( " 1.0.0-alpha-a.b-c-somethinglong+build.1-aef.1-its-okay " . wholeMatch ( of : semVerRegex ) )
35+ XCTAssertNotNil ( " 1.0.0-rc.1+build.1 " . wholeMatch ( of : semVerRegex ) )
36+ XCTAssertNotNil ( " 2.0.0-rc.1+build.123 " . wholeMatch ( of : semVerRegex ) )
37+ XCTAssertNotNil ( " 1.2.3-beta " . wholeMatch ( of : semVerRegex ) )
38+ XCTAssertNotNil ( " 10.2.3-DEV-SNAPSHOT " . wholeMatch ( of : semVerRegex ) )
39+ XCTAssertNotNil ( " 1.2.3-SNAPSHOT-123 " . wholeMatch ( of : semVerRegex ) )
40+ XCTAssertNotNil ( " 1.0.0 " . wholeMatch ( of : semVerRegex ) )
41+ XCTAssertNotNil ( " 2.0.0 " . wholeMatch ( of : semVerRegex ) )
42+ XCTAssertNotNil ( " 1.1.7 " . wholeMatch ( of : semVerRegex ) )
43+ XCTAssertNotNil ( " 2.0.0+build.1848 " . wholeMatch ( of : semVerRegex ) )
44+ XCTAssertNotNil ( " 2.0.1-alpha.1227 " . wholeMatch ( of : semVerRegex ) )
45+ XCTAssertNotNil ( " 1.0.0-alpha+beta " . wholeMatch ( of : semVerRegex ) )
46+ XCTAssertNotNil ( " 1.2.3----RC-SNAPSHOT.12.9.1--.12+788 " . wholeMatch ( of : semVerRegex ) )
47+ XCTAssertNotNil ( " 1.2.3----R-S.12.9.1--.12+meta " . wholeMatch ( of : semVerRegex ) )
48+ XCTAssertNotNil ( " 1.2.3----RC-SNAPSHOT.12.9.1--.12 " . wholeMatch ( of : semVerRegex ) )
49+ XCTAssertNotNil ( " 1.0.0+0.build.1-rc.10000aaa-kk-0.1 " . wholeMatch ( of : semVerRegex ) )
50+ XCTAssertNotNil ( " 99999999999999999999999.999999999999999999.99999999999999999 " . wholeMatch ( of : semVerRegex ) )
51+ XCTAssertNotNil ( " 1.0.0-0A.is.legal " . wholeMatch ( of : semVerRegex ) )
5252 }
5353
5454 func test_allow_leading_v( ) throws {
55- XCTAssert ( semVerRegex . matches ( " v0.0.4 " ) )
55+ XCTAssertNotNil ( " v0.0.4 " . wholeMatch ( of : semVerRegex ) )
5656 }
5757
5858 func test_semVerRegex_invalid( ) throws {
59- XCTAssertFalse ( semVerRegex . matches ( " 1 " ) )
60- XCTAssertFalse ( semVerRegex . matches ( " 1.2 " ) )
61- XCTAssertFalse ( semVerRegex . matches ( " 1.2.3-0123 " ) )
62- XCTAssertFalse ( semVerRegex . matches ( " 1.2.3-0123.0123 " ) )
63- XCTAssertFalse ( semVerRegex . matches ( " 1.1.2+.123 " ) )
64- XCTAssertFalse ( semVerRegex . matches ( " +invalid " ) )
65- XCTAssertFalse ( semVerRegex . matches ( " -invalid " ) )
66- XCTAssertFalse ( semVerRegex . matches ( " -invalid+invalid " ) )
67- XCTAssertFalse ( semVerRegex . matches ( " -invalid.01 " ) )
68- XCTAssertFalse ( semVerRegex . matches ( " alpha " ) )
69- XCTAssertFalse ( semVerRegex . matches ( " alpha.beta " ) )
70- XCTAssertFalse ( semVerRegex . matches ( " alpha.beta.1 " ) )
71- XCTAssertFalse ( semVerRegex . matches ( " alpha.1 " ) )
72- XCTAssertFalse ( semVerRegex . matches ( " alpha+beta " ) )
73- XCTAssertFalse ( semVerRegex . matches ( " alpha_beta " ) )
74- XCTAssertFalse ( semVerRegex . matches ( " alpha. " ) )
75- XCTAssertFalse ( semVerRegex . matches ( " alpha.. " ) )
76- XCTAssertFalse ( semVerRegex . matches ( " beta " ) )
77- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha_beta " ) )
78- XCTAssertFalse ( semVerRegex . matches ( " -alpha. " ) )
79- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha.. " ) )
80- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha..1 " ) )
81- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha...1 " ) )
82- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha....1 " ) )
83- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha.....1 " ) )
84- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha......1 " ) )
85- XCTAssertFalse ( semVerRegex . matches ( " 1.0.0-alpha.......1 " ) )
86- XCTAssertFalse ( semVerRegex . matches ( " 01.1.1 " ) )
87- XCTAssertFalse ( semVerRegex . matches ( " 1.01.1 " ) )
88- XCTAssertFalse ( semVerRegex . matches ( " 1.1.01 " ) )
89- XCTAssertFalse ( semVerRegex . matches ( " 1.2 " ) )
90- XCTAssertFalse ( semVerRegex . matches ( " 1.2.3.DEV " ) )
91- XCTAssertFalse ( semVerRegex . matches ( " 1.2-SNAPSHOT " ) )
92- XCTAssertFalse ( semVerRegex . matches ( " 1.2.31.2.3----RC-SNAPSHOT.12.09.1--..12+788 " ) )
93- XCTAssertFalse ( semVerRegex . matches ( " 1.2-RC-SNAPSHOT " ) )
94- XCTAssertFalse ( semVerRegex . matches ( " -1.0.3-gamma+b7718 " ) )
95- XCTAssertFalse ( semVerRegex . matches ( " +justmeta " ) )
96- XCTAssertFalse ( semVerRegex . matches ( " 9.8.7+meta+meta " ) )
97- XCTAssertFalse ( semVerRegex . matches ( " 9.8.7-whatever+meta+meta " ) )
59+ XCTAssertNil ( " 1 " . wholeMatch ( of : semVerRegex ) )
60+ XCTAssertNil ( " 1.2 " . wholeMatch ( of : semVerRegex ) )
61+ XCTAssertNil ( " 1.2.3-0123 " . wholeMatch ( of : semVerRegex ) )
62+ XCTAssertNil ( " 1.2.3-0123.0123 " . wholeMatch ( of : semVerRegex ) )
63+ XCTAssertNil ( " 1.1.2+.123 " . wholeMatch ( of : semVerRegex ) )
64+ XCTAssertNil ( " +invalid " . wholeMatch ( of : semVerRegex ) )
65+ XCTAssertNil ( " -invalid " . wholeMatch ( of : semVerRegex ) )
66+ XCTAssertNil ( " -invalid+invalid " . wholeMatch ( of : semVerRegex ) )
67+ XCTAssertNil ( " -invalid.01 " . wholeMatch ( of : semVerRegex ) )
68+ XCTAssertNil ( " alpha " . wholeMatch ( of : semVerRegex ) )
69+ XCTAssertNil ( " alpha.beta " . wholeMatch ( of : semVerRegex ) )
70+ XCTAssertNil ( " alpha.beta.1 " . wholeMatch ( of : semVerRegex ) )
71+ XCTAssertNil ( " alpha.1 " . wholeMatch ( of : semVerRegex ) )
72+ XCTAssertNil ( " alpha+beta " . wholeMatch ( of : semVerRegex ) )
73+ XCTAssertNil ( " alpha_beta " . wholeMatch ( of : semVerRegex ) )
74+ XCTAssertNil ( " alpha. " . wholeMatch ( of : semVerRegex ) )
75+ XCTAssertNil ( " alpha.. " . wholeMatch ( of : semVerRegex ) )
76+ XCTAssertNil ( " beta " . wholeMatch ( of : semVerRegex ) )
77+ XCTAssertNil ( " 1.0.0-alpha_beta " . wholeMatch ( of : semVerRegex ) )
78+ XCTAssertNil ( " -alpha. " . wholeMatch ( of : semVerRegex ) )
79+ XCTAssertNil ( " 1.0.0-alpha.. " . wholeMatch ( of : semVerRegex ) )
80+ XCTAssertNil ( " 1.0.0-alpha..1 " . wholeMatch ( of : semVerRegex ) )
81+ XCTAssertNil ( " 1.0.0-alpha...1 " . wholeMatch ( of : semVerRegex ) )
82+ XCTAssertNil ( " 1.0.0-alpha....1 " . wholeMatch ( of : semVerRegex ) )
83+ XCTAssertNil ( " 1.0.0-alpha.....1 " . wholeMatch ( of : semVerRegex ) )
84+ XCTAssertNil ( " 1.0.0-alpha......1 " . wholeMatch ( of : semVerRegex ) )
85+ XCTAssertNil ( " 1.0.0-alpha.......1 " . wholeMatch ( of : semVerRegex ) )
86+ XCTAssertNil ( " 01.1.1 " . wholeMatch ( of : semVerRegex ) )
87+ XCTAssertNil ( " 1.01.1 " . wholeMatch ( of : semVerRegex ) )
88+ XCTAssertNil ( " 1.1.01 " . wholeMatch ( of : semVerRegex ) )
89+ XCTAssertNil ( " 1.2 " . wholeMatch ( of : semVerRegex ) )
90+ XCTAssertNil ( " 1.2.3.DEV " . wholeMatch ( of : semVerRegex ) )
91+ XCTAssertNil ( " 1.2-SNAPSHOT " . wholeMatch ( of : semVerRegex ) )
92+ XCTAssertNil ( " 1.2.31.2.3----RC-SNAPSHOT.12.09.1--..12+788 " . wholeMatch ( of : semVerRegex ) )
93+ XCTAssertNil ( " 1.2-RC-SNAPSHOT " . wholeMatch ( of : semVerRegex ) )
94+ XCTAssertNil ( " -1.0.3-gamma+b7718 " . wholeMatch ( of : semVerRegex ) )
95+ XCTAssertNil ( " +justmeta " . wholeMatch ( of : semVerRegex ) )
96+ XCTAssertNil ( " 9.8.7+meta+meta " . wholeMatch ( of : semVerRegex ) )
97+ XCTAssertNil ( " 9.8.7-whatever+meta+meta " . wholeMatch ( of : semVerRegex ) )
9898 }
9999
100100 func test_init( ) throws {
0 commit comments