Skip to content

Commit bc2a151

Browse files
authored
Publicize Swift Testing's underlying Test.ID (#131)
* Publicize Swift Testing's underlying Test.ID This allows Issue Reporting's provided ID to be compared to the underlying Test.ID value from Swift Testing. * Add Xcode 16 to CI * Update ci.yml * fix * fix
1 parent b185073 commit bc2a151

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ jobs:
2020
- debug
2121
- release
2222
xcode:
23-
- 15.4
2423
- 15.2
24+
- 15.4
25+
- 16_beta_6
2526
name: macOS
2627
runs-on: macos-14
2728
steps:
@@ -47,12 +48,15 @@ jobs:
4748
config:
4849
- Debug
4950
- Release
51+
xcode:
52+
- 15.4
53+
- 16_beta_6
5054
name: Examples
5155
runs-on: macos-14
5256
steps:
5357
- uses: actions/checkout@v4
5458
- name: Select Xcode
55-
run: sudo xcode-select -s /Applications/Xcode_15.4.app
59+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
5660
- name: Run tests
5761
run: make CONFIG=${{ matrix.config }} test-examples
5862

@@ -81,7 +85,7 @@ jobs:
8185
matrix:
8286
toolchain:
8387
- wasm-5.9.2-RELEASE
84-
- wasm-5.10.0-RELEASE
88+
- wasm-5.10.0-RELEASE
8589
steps:
8690
- name: Cache toolchains
8791
uses: actions/cache@v3

Examples/ExamplesTests/SwiftTestingTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
struct SwiftTestingTests_Debug {
88
@Test func context() {
99
switch TestContext.current {
10-
case .xcTest:
10+
case .swiftTesting:
1111
#expect(Bool(true))
1212
default:
1313
Issue.record()

Sources/IssueReporting/IsTesting.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@
3030
if environment.keys.contains("XCTestBundlePath") { return true }
3131
if environment.keys.contains("XCTestConfigurationFilePath") { return true }
3232
if environment.keys.contains("XCTestSessionIdentifier") { return true }
33+
3334
return arguments.contains { argument in
3435
let path = URL(fileURLWithPath: argument)
35-
return path.lastPathComponent == "xctest" || path.pathExtension == "xctest"
36+
return path.lastPathComponent == "swiftpm-testing-helper"
37+
|| argument == "--testing-library"
38+
|| path.lastPathComponent == "xctest"
39+
|| path.pathExtension == "xctest"
3640
}
3741
}
3842
}

Sources/IssueReporting/TestContext.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// A type representing the context in which a test is being run, _i.e._ either in Swift's native
22
/// Testing framework, or Xcode's XCTest framework.
3-
public enum TestContext: Equatable {
3+
public enum TestContext: Equatable, Sendable {
44
/// The Swift Testing framework.
55
case swiftTesting(Testing?)
66

@@ -37,14 +37,14 @@ public enum TestContext: Equatable {
3737
return true
3838
}
3939

40-
public struct Testing: Equatable {
40+
public struct Testing: Equatable, Sendable {
4141
public let test: Test
4242

4343
public struct Test: Equatable, Hashable, Identifiable, Sendable {
4444
public let id: ID
4545

4646
public struct ID: Equatable, Hashable, @unchecked Sendable {
47-
fileprivate let rawValue: AnyHashable
47+
public let rawValue: AnyHashable
4848
}
4949
}
5050
}

0 commit comments

Comments
 (0)