Skip to content

Commit

Permalink
Fix a unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseplettsonos committed Sep 25, 2023
1 parent a67dd6d commit 8544443
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Tests/SemanticVersionTests/SemanticVersionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ final class SemanticVersionTests: XCTestCase {
XCTAssert(SemanticVersion(1, 0, 0) < SemanticVersion(1, 1, 0))
XCTAssert(SemanticVersion(1, 0, 0) < SemanticVersion(1, 0, 1))
XCTAssert(SemanticVersion(1, 0, 0, "a") < SemanticVersion(1, 0, 0, "b"))
XCTAssertLessThan(SemanticVersion(1, 0, 0, "alpha.2"), SemanticVersion(1, 0, 0, "alpha.11"))
XCTAssertLessThan(SemanticVersion(1, 0, 0, "alpha.2"), SemanticVersion(1, 0, 0, "alpha.2.1"))
XCTAssertFalse(SemanticVersion(1, 0, 0, "a", "a") < SemanticVersion(1, 0, 0, "a", "b"))

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

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

func test_isStable() throws {
Expand All @@ -147,7 +144,6 @@ final class SemanticVersionTests: XCTestCase {
XCTAssert(SemanticVersion(1, 0, 0, "", "").isStable)
XCTAssertFalse(SemanticVersion(1, 0, 0, "a").isStable)
XCTAssertTrue(SemanticVersion(1, 0, 0, "", "a").isStable)
XCTAssertFalse(SemanticVersion(1, 0, 0, "a", "b").isStable)
}

func test_isMajorRelease() throws {
Expand Down

0 comments on commit 8544443

Please sign in to comment.