Skip to content

Commit a674d70

Browse files
authored
Add test target without test support linking. (#152)
* Add test target without test support linking. * wip
1 parent e5afd30 commit a674d70

File tree

4 files changed

+79
-2
lines changed

4 files changed

+79
-2
lines changed

Package.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ let package = Package(
3737
"IssueReportingTestSupport",
3838
]
3939
),
40+
.testTarget(
41+
name: "IssueReportingTestsNoSupport",
42+
dependencies: [
43+
"IssueReporting",
44+
]
45+
),
4046
.target(
4147
name: "IssueReportingTestSupport",
4248
dependencies: [

[email protected]

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ let package = Package(
3636
"IssueReportingTestSupport",
3737
]
3838
),
39+
.testTarget(
40+
name: "IssueReportingTestsNoSupport",
41+
dependencies: [
42+
"IssueReporting",
43+
]
44+
),
3945
.target(
4046
name: "IssueReportingTestSupport",
4147
dependencies: [

Tests/IssueReporting.xctestplan

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212

1313
},
1414
"testTargets" : [
15+
{
16+
"target" : {
17+
"containerPath" : "container:Examples\/Examples.xcodeproj",
18+
"identifier" : "CADE79BA2C4A9D2D005A85F7",
19+
"name" : "ExamplesTests"
20+
}
21+
},
22+
{
23+
"target" : {
24+
"containerPath" : "container:",
25+
"identifier" : "XCTestDynamicOverlayTests",
26+
"name" : "XCTestDynamicOverlayTests"
27+
}
28+
},
1529
{
1630
"target" : {
1731
"containerPath" : "container:",
@@ -22,8 +36,8 @@
2236
{
2337
"target" : {
2438
"containerPath" : "container:",
25-
"identifier" : "XCTestDynamicOverlayTests",
26-
"name" : "XCTestDynamicOverlayTests"
39+
"identifier" : "IssueReportingTestsNoSupport",
40+
"name" : "IssueReportingTestsNoSupport"
2741
}
2842
}
2943
],
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#if canImport(Testing)
2+
import IssueReporting
3+
import Testing
4+
5+
@Suite struct WithExpectedIssueTests {
6+
@Test func sync() {
7+
withExpectedIssue {
8+
reportIssue()
9+
}
10+
}
11+
12+
@Test func syncThrows() throws {
13+
withExpectedIssue {
14+
reportIssue()
15+
throw SomeError()
16+
}
17+
}
18+
19+
@Test func asyncAwaitBefore() async {
20+
await withExpectedIssue {
21+
await Task.yield()
22+
reportIssue()
23+
}
24+
}
25+
26+
@Test func asyncAwaitAfter() async {
27+
await withExpectedIssue {
28+
reportIssue()
29+
await Task.yield()
30+
}
31+
}
32+
33+
@Test func asyncAwaitBeforeThrows() async throws {
34+
await withExpectedIssue {
35+
await Task.yield()
36+
reportIssue()
37+
throw SomeError()
38+
}
39+
}
40+
41+
@Test func asyncAwaitAfterThrows() async throws {
42+
await withExpectedIssue {
43+
reportIssue()
44+
await Task.yield()
45+
throw SomeError()
46+
}
47+
}
48+
}
49+
50+
private struct SomeError: Error {}
51+
#endif

0 commit comments

Comments
 (0)