Skip to content

Commit f62dac9

Browse files
committed
Add and fix missing Triple tests (#6842)
Vendored Swift Driver triple was not checked against a few tests that weren't brought over from TSC after `TSC.Triple` type was deprecated. We should fix those tests, especially as they verified that per-component equality for triples worked instead of the current string-based equality check. Also fixed some of the `Utilities/soundness.sh` script failures. Related to rdar://113967401
1 parent fdd0528 commit f62dac9

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

Sources/Basics/Triple+Basics.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ extension Triple {
189189
guard self != triple else {
190190
return true
191191
}
192+
192193
if
193194
self.arch == triple.arch &&
194195
self.vendor == triple.vendor &&

Tests/BasicsTests/TripleTests.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,19 +170,19 @@ final class TripleTests: XCTestCase {
170170
let linux = try? Triple("x86_64-unknown-linux-gnu")
171171
XCTAssertNotNil(linux)
172172
XCTAssertEqual(linux!.os, .linux)
173-
XCTAssertNil(linux!.osVersion)
173+
XCTAssertEqual(linux!.osVersion, Triple.Version.zero)
174174
XCTAssertEqual(linux!.environment, .gnu)
175175

176176
let macos = try? Triple("x86_64-apple-macosx10.15")
177177
XCTAssertNotNil(macos!)
178-
XCTAssertEqual(macos!.osVersion, .init(parse: "10.15")!)
178+
XCTAssertEqual(macos!.osVersion, .init(parse: "10.15"))
179179
let newVersion = "10.12"
180180
let tripleString = macos!.tripleString(forPlatformVersion: newVersion)
181181
XCTAssertEqual(tripleString, "x86_64-apple-macosx10.12")
182182
let macosNoX = try? Triple("x86_64-apple-macos12.2")
183183
XCTAssertNotNil(macosNoX!)
184184
XCTAssertEqual(macosNoX!.os, .macosx)
185-
XCTAssertEqual(macosNoX!.osVersion, .init(parse: "12.2")!)
185+
XCTAssertEqual(macosNoX!.osVersion, .init(parse: "12.2"))
186186

187187
let android = try? Triple("aarch64-unknown-linux-android24")
188188
XCTAssertNotNil(android)
@@ -220,11 +220,4 @@ final class TripleTests: XCTestCase {
220220
try XCTAssertFalse(Triple("x86_64-apple-macosx").isRuntimeCompatible(with: Triple("x86_64-apple-linux")))
221221
try XCTAssertTrue(Triple("x86_64-apple-macosx14.0").isRuntimeCompatible(with: Triple("x86_64-apple-macosx13.0")))
222222
}
223-
224-
func testIsRuntimeCompatibleWith() throws {
225-
try XCTAssertTrue(Triple("x86_64-apple-macosx").isRuntimeCompatible(with: Triple("x86_64-apple-macosx")))
226-
try XCTAssertTrue(Triple("x86_64-unknown-linux").isRuntimeCompatible(with: Triple("x86_64-unknown-linux")))
227-
try XCTAssertFalse(Triple("x86_64-apple-macosx").isRuntimeCompatible(with: Triple("x86_64-apple-linux")))
228-
try XCTAssertTrue(Triple("x86_64-apple-macosx14.0").isRuntimeCompatible(with: Triple("x86_64-apple-macosx13.0")))
229-
}
230223
}

0 commit comments

Comments
 (0)