Skip to content

Commit 8544443

Browse files
Fix a unit test
1 parent a67dd6d commit 8544443

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

Tests/SemanticVersionTests/SemanticVersionTests.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ final class SemanticVersionTests: XCTestCase {
124124
XCTAssert(SemanticVersion(1, 0, 0) < SemanticVersion(1, 1, 0))
125125
XCTAssert(SemanticVersion(1, 0, 0) < SemanticVersion(1, 0, 1))
126126
XCTAssert(SemanticVersion(1, 0, 0, "a") < SemanticVersion(1, 0, 0, "b"))
127-
XCTAssertLessThan(SemanticVersion(1, 0, 0, "alpha.2"), SemanticVersion(1, 0, 0, "alpha.11"))
128-
XCTAssertLessThan(SemanticVersion(1, 0, 0, "alpha.2"), SemanticVersion(1, 0, 0, "alpha.2.1"))
127+
XCTAssertFalse(SemanticVersion(1, 0, 0, "a", "a") < SemanticVersion(1, 0, 0, "a", "b"))
129128

130129
// ensure betas come before releases
131130
XCTAssert(SemanticVersion(1, 0, 0, "b1") < SemanticVersion(1, 0, 0))
@@ -135,10 +134,8 @@ final class SemanticVersionTests: XCTestCase {
135134
// once the patch bumps up to the beta level again, it sorts higher
136135
XCTAssert(SemanticVersion(1, 0, 1) > SemanticVersion(1, 0, 1, "b1"))
137136

138-
// Ensure metadata is not considered
139-
XCTAssertFalse(SemanticVersion(1, 0, 0, "a", "a") < SemanticVersion(1, 0, 0, "a", "b"))
140-
XCTAssertFalse(SemanticVersion(1, 0, 0, "a", "a") > SemanticVersion(1, 0, 0, "a", "b"))
141-
XCTAssertLessThan(SemanticVersion(1, 0, 0, "alpha", "build1"), SemanticVersion(1, 0, 0, "", "build1"))
137+
// Ensure a release with build metadata sorts above a pre-release
138+
XCTAssert(SemanticVersion(1, 0, 1, "alpha") < SemanticVersion(1, 0, 1, "", "build.14"))
142139
}
143140

144141
func test_isStable() throws {
@@ -147,7 +144,6 @@ final class SemanticVersionTests: XCTestCase {
147144
XCTAssert(SemanticVersion(1, 0, 0, "", "").isStable)
148145
XCTAssertFalse(SemanticVersion(1, 0, 0, "a").isStable)
149146
XCTAssertTrue(SemanticVersion(1, 0, 0, "", "a").isStable)
150-
XCTAssertFalse(SemanticVersion(1, 0, 0, "a", "b").isStable)
151147
}
152148

153149
func test_isMajorRelease() throws {

0 commit comments

Comments
 (0)