From e2766468910ee2a4bda58cc993a8dde72d6c668f Mon Sep 17 00:00:00 2001 From: Ryan Zulkoski Date: Mon, 10 Jul 2023 09:55:03 -0500 Subject: [PATCH] Added support for parsing "b" as "beta" and added another assertion to test case. --- Sources/XcodesKit/Version+Xcode.swift | 2 ++ Tests/XcodesKitTests/Models+FirstWithVersionTests.swift | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Sources/XcodesKit/Version+Xcode.swift b/Sources/XcodesKit/Version+Xcode.swift index 26aa9e1..af8e279 100644 --- a/Sources/XcodesKit/Version+Xcode.swift +++ b/Sources/XcodesKit/Version+Xcode.swift @@ -43,6 +43,8 @@ public extension Version { optionalPrereleaseIdentifiers[lastIndex] = "\(lastItem)-seed" } + } else if type == "b" { + optionalPrereleaseIdentifiers.append("beta") } else { optionalPrereleaseIdentifiers.append(type) } diff --git a/Tests/XcodesKitTests/Models+FirstWithVersionTests.swift b/Tests/XcodesKitTests/Models+FirstWithVersionTests.swift index 489b9be..df6d8dd 100644 --- a/Tests/XcodesKitTests/Models+FirstWithVersionTests.swift +++ b/Tests/XcodesKitTests/Models+FirstWithVersionTests.swift @@ -91,6 +91,10 @@ final class ModelsFirstWithVersionTests: XCTestCase { installedXcodes.first(withVersion: Version(xcodeVersion: "1.2.3 Beta 2")!), InstalledXcode(path: Path("/Applications/Xcode-1.2.3-beta.2.app")!, version: Version(xcodeVersion: "1.2.3 Beta 2")!) ) + XCTAssertEqual( + installedXcodes.first(withVersion: Version(xcodeVersion: "1.2.3b2")!), + InstalledXcode(path: Path("/Applications/Xcode-1.2.3-beta.2.app")!, version: Version(xcodeVersion: "1.2.3 Beta 2")!) + ) // With build metadata XCTAssertEqual(