1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 03:50:08 +02:00

🏗 Improved version comparison

This commit is contained in:
2023-02-05 17:18:09 +01:00
parent 208a430066
commit 78e682688b
9 changed files with 109 additions and 44 deletions

View File

@ -16,8 +16,8 @@ class CaskFileParserTest: XCTestCase {
.url(forResource: "phpmon-dev", withExtension: "rb")!
}
func test_can_extract_fields_from_cask_file() throws {
guard let caskFile = CaskFile.from(url: CaskFileParserTest.exampleFilePath) else {
func test_can_extract_fields_from_cask_file() async throws {
guard let caskFile = await CaskFile.from(url: CaskFileParserTest.exampleFilePath) else {
return XCTFail("The CaskFile could not be parsed, check the log for more info")
}
@ -39,8 +39,8 @@ class CaskFileParserTest: XCTestCase {
)
}
func test_can_extract_fields_from_remote_cask_file() throws {
guard let caskFile = CaskFile.from(url: Constants.Urls.StableBuildCaskFile) else {
func test_can_extract_fields_from_remote_cask_file() async throws {
guard let caskFile = await CaskFile.from(url: Constants.Urls.StableBuildCaskFile) else {
return XCTFail("The remote CaskFile could not be parsed, check the log for more info")
}

View File

@ -28,7 +28,7 @@ class AppVersionTest: XCTestCase {
XCTAssertNotNil(version)
XCTAssertEqual("1.0.0", version?.version)
XCTAssertEqual("600", version?.build)
XCTAssertEqual(600, version?.build)
XCTAssertEqual(nil, version?.suffix)
}
@ -46,7 +46,7 @@ class AppVersionTest: XCTestCase {
XCTAssertNotNil(version)
XCTAssertEqual("1.0.0", version?.version)
XCTAssertEqual("870", version?.build)
XCTAssertEqual(870, version?.build)
XCTAssertEqual("dev", version?.suffix)
}
@ -55,8 +55,26 @@ class AppVersionTest: XCTestCase {
XCTAssertNotNil(version)
XCTAssertEqual("1.0.0", version?.version)
XCTAssertEqual("870", version?.build)
XCTAssertEqual(870, version?.build)
XCTAssertEqual("dev", version?.suffix)
}
func test_can_compare_version_numbers() {
var first = AppVersion.from("5.0_100")!
var second = AppVersion.from("5.0_101")!
XCTAssertTrue(second > first)
first = AppVersion.from("5.0_100")!
second = AppVersion.from("5.0_100")!
XCTAssertFalse(second > first)
first = AppVersion.from("5.0_100")!
second = AppVersion.from("5.0.1_100")!
XCTAssertFalse(second > first)
first = AppVersion.from("5.0_102")!
second = AppVersion.from("5.0_101")!
XCTAssertFalse(second > first)
}
}