From 85444439453b1b05d3d5820807f2052cd541f88d Mon Sep 17 00:00:00 2001 From: Chris Eplett Date: Mon, 12 Jun 2023 12:02:51 -0400 Subject: [PATCH] Fix a unit test --- Tests/SemanticVersionTests/SemanticVersionTests.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Tests/SemanticVersionTests/SemanticVersionTests.swift b/Tests/SemanticVersionTests/SemanticVersionTests.swift index ba26755..a3ad6c6 100644 --- a/Tests/SemanticVersionTests/SemanticVersionTests.swift +++ b/Tests/SemanticVersionTests/SemanticVersionTests.swift @@ -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)) @@ -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 { @@ -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 {