Skip to content

Commit c50518d

Browse files
Tests: Fix test for SWIFT_TESTING_ENABLED environment variable
`SWIFT_PM_TEST_LIBRARY` was renamed to `SWIFT_TESTING_ENABLED` in #7789, but we forgot to update the test because `XCTAssertAsyncNoThrow` always succeeded and we didn't notice the failure.
1 parent 2beb621 commit c50518d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Fixtures/Miscellaneous/CheckTestLibraryEnvironmentVariable/Tests/CheckTestLibraryEnvironmentVariableTests/CheckTestLibraryEnvironmentVariableTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import XCTest
22

33
final class CheckTestLibraryEnvironmentVariableTests: XCTestCase {
44
func testEnviromentVariable() throws {
5-
let envvar = ProcessInfo.processInfo.environment["SWIFT_PM_TEST_LIBRARY"]
6-
XCTAssertEqual(envvar, "XCTest")
5+
let envvar = ProcessInfo.processInfo.environment["SWIFT_TESTING_ENABLED"]
6+
XCTAssertEqual(envvar, "0")
77
}
88
}

Tests/CommandsTests/TestCommandTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,14 @@ final class TestCommandTests: CommandsTestCase {
327327
}
328328
#endif
329329

330+
#if os(macOS)
331+
// "SWIFT_TESTING_ENABLED" is set only on macOS, skip the check on other platforms.
330332
func testLibraryEnvironmentVariable() async throws {
331333
try await fixture(name: "Miscellaneous/CheckTestLibraryEnvironmentVariable") { fixturePath in
332334
await XCTAssertAsyncNoThrow(try await SwiftPM.Test.execute(packagePath: fixturePath))
333335
}
334336
}
337+
#endif
335338

336339
func testXCTestOnlyDoesNotLogAboutNoMatchingTests() async throws {
337340
try await fixture(name: "Miscellaneous/TestDiscovery/Simple") { fixturePath in

0 commit comments

Comments
 (0)