Skip to content

Commit

Permalink
Merge pull request #39 from SwiftPackageIndex/swift-5.10
Browse files Browse the repository at this point in the history
Add Swift 5.10
  • Loading branch information
finestructure authored Feb 13, 2024
2 parents 49d1003 + 61d0218 commit ac6611f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Sources/SPIManifest/SwiftVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public typealias ShortVersion = String


public enum SwiftVersion: ShortVersion, Codable, CaseIterable {
case v5_6 = "5.6"
case v5_7 = "5.7"
case v5_8 = "5.8"
case v5_9 = "5.9"
case v5_10 = "5.10"

public static var latestRelease: Self { .v5_9 }

Expand Down
26 changes: 13 additions & 13 deletions Tests/SPIManifestTests/ManifestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ class ManifestTests: XCTestCase {
do { // match
let m = Manifest(builder: .init(configs: [
.init(platform: Platform.iOS.rawValue,
swiftVersion: "5.6")
swiftVersion: "5.9")
]))

// MUT
XCTAssertNotNil(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_6)))
XCTAssertNotNil(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_9)))
}

do { // no matching platform
Expand All @@ -144,7 +144,7 @@ class ManifestTests: XCTestCase {
]))

// MUT
XCTAssertNil(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_6)))
XCTAssertNil(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_9)))
}

do { // no matching version
Expand All @@ -154,17 +154,17 @@ class ManifestTests: XCTestCase {
]))

// MUT
XCTAssertNil(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_6)))
XCTAssertNil(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_9)))
}

do { // pick specific swift version over nil one
let m = Manifest(builder: .init(configs: [
.init(platform: Platform.iOS.rawValue, scheme: "scheme-1"),
.init(platform: Platform.iOS.rawValue, swiftVersion: "5.6", scheme: "scheme-2")
.init(platform: Platform.iOS.rawValue, swiftVersion: "5.9", scheme: "scheme-2")
]))

// MUT
XCTAssertEqual(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_6))?.scheme, "scheme-2")
XCTAssertEqual(m.config(platform: .specific(.iOS), swiftVersion: .specific(.v5_9))?.scheme, "scheme-2")
}
}

Expand All @@ -184,12 +184,12 @@ class ManifestTests: XCTestCase {
// Test `config` selector
let m = Manifest(builder: .init(configs: [
.init(platform: Platform.linux.rawValue),
.init(platform: Platform.iOS.rawValue, swiftVersion: "5.6", scheme: "scheme-1"),
.init(platform: Platform.iOS.rawValue, swiftVersion: "5.9", scheme: "scheme-1"),
.init(platform: Platform.iOS.rawValue, scheme: "scheme-2")
]))

// MUT
XCTAssertEqual(m.config(swiftVersion: .specific(.v5_6))?.scheme, "scheme-1")
XCTAssertEqual(m.config(swiftVersion: .specific(.v5_9))?.scheme, "scheme-1")
}

func test_documentationTargets_bare_default() throws {
Expand Down Expand Up @@ -254,13 +254,13 @@ class ManifestTests: XCTestCase {
builder:
configs:
- documentation_targets: [t0]
swift_version: 5.6
swift_version: 5.8
"""
)

for s in SwiftVersion.allCases {
for p in Platform.allCases {
if p == .macosSpm && s == .v5_6 {
if p == .macosSpm && s == .v5_8 {
XCTAssertEqual(
m.documentationTargets(platform: p, swiftVersion: s), ["t0"],
"failed for (\(p), \(s))"
Expand All @@ -282,7 +282,7 @@ class ManifestTests: XCTestCase {
builder:
configs:
- documentation_targets: [t0]
swift_version: 5.6
swift_version: 5.8
- documentation_targets: [t0]
platform: ios
"""
Expand All @@ -291,7 +291,7 @@ class ManifestTests: XCTestCase {
for s in SwiftVersion.allCases {
for p in Platform.allCases {
switch (p, s) {
case (.iOS, .latestRelease), (.macosSpm, .v5_6):
case (.iOS, .latestRelease), (.macosSpm, .v5_8):
XCTAssertEqual(
m.documentationTargets(platform: p, swiftVersion: s), ["t0"],
"failed for (\(p), \(s))"
Expand Down Expand Up @@ -330,9 +330,9 @@ class ManifestTests: XCTestCase {

// MUT
XCTAssertEqual(m.documentationTargets(platform: .watchOS, swiftVersion: .v5_7), ["t3"])
XCTAssertEqual(m.documentationTargets(platform: .watchOS, swiftVersion: .v5_6), nil)
XCTAssertEqual(m.documentationTargets(platform: .macosSpm, swiftVersion: .v5_8), nil)
XCTAssertEqual(m.documentationTargets(platform: .macosSpm, swiftVersion: .v5_9), ["t0"])
XCTAssertEqual(m.documentationTargets(platform: .watchOS, swiftVersion: .v5_10), nil)
}

func test_allDocumentationTargets() throws {
Expand Down
2 changes: 1 addition & 1 deletion Tests/SPIManifestTests/SwiftVersionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class SwiftVersionTests: XCTestCase {
}

func test_Comparable() throws {
XCTAssert(SwiftVersion.v5_10 > .v5_9)
XCTAssert(SwiftVersion.v5_9 > .v5_8)
XCTAssert(SwiftVersion.v5_8 > .v5_7)
XCTAssert(SwiftVersion.v5_7 > .v5_6)
}

}

0 comments on commit ac6611f

Please sign in to comment.