diff --git a/Package.swift b/Package.swift index 1c50b17..eab3b4a 100644 --- a/Package.swift +++ b/Package.swift @@ -37,6 +37,12 @@ let package = Package( "IssueReportingTestSupport", ] ), + .testTarget( + name: "IssueReportingTestsNoSupport", + dependencies: [ + "IssueReporting", + ] + ), .target( name: "IssueReportingTestSupport", dependencies: [ diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift index f8f1bcd..c117b36 100644 --- a/Package@swift-6.0.swift +++ b/Package@swift-6.0.swift @@ -36,6 +36,12 @@ let package = Package( "IssueReportingTestSupport", ] ), + .testTarget( + name: "IssueReportingTestsNoSupport", + dependencies: [ + "IssueReporting", + ] + ), .target( name: "IssueReportingTestSupport", dependencies: [ diff --git a/Tests/IssueReporting.xctestplan b/Tests/IssueReporting.xctestplan index b07d2dc..cd3ed07 100644 --- a/Tests/IssueReporting.xctestplan +++ b/Tests/IssueReporting.xctestplan @@ -12,6 +12,20 @@ }, "testTargets" : [ + { + "target" : { + "containerPath" : "container:Examples\/Examples.xcodeproj", + "identifier" : "CADE79BA2C4A9D2D005A85F7", + "name" : "ExamplesTests" + } + }, + { + "target" : { + "containerPath" : "container:", + "identifier" : "XCTestDynamicOverlayTests", + "name" : "XCTestDynamicOverlayTests" + } + }, { "target" : { "containerPath" : "container:", @@ -22,8 +36,8 @@ { "target" : { "containerPath" : "container:", - "identifier" : "XCTestDynamicOverlayTests", - "name" : "XCTestDynamicOverlayTests" + "identifier" : "IssueReportingTestsNoSupport", + "name" : "IssueReportingTestsNoSupport" } } ], diff --git a/Tests/IssueReportingTestsNoSupport/WithExpectedIssueTests.swift b/Tests/IssueReportingTestsNoSupport/WithExpectedIssueTests.swift new file mode 100644 index 0000000..fc2f724 --- /dev/null +++ b/Tests/IssueReportingTestsNoSupport/WithExpectedIssueTests.swift @@ -0,0 +1,51 @@ +#if canImport(Testing) + import IssueReporting + import Testing + + @Suite struct WithExpectedIssueTests { + @Test func sync() { + withExpectedIssue { + reportIssue() + } + } + + @Test func syncThrows() throws { + withExpectedIssue { + reportIssue() + throw SomeError() + } + } + + @Test func asyncAwaitBefore() async { + await withExpectedIssue { + await Task.yield() + reportIssue() + } + } + + @Test func asyncAwaitAfter() async { + await withExpectedIssue { + reportIssue() + await Task.yield() + } + } + + @Test func asyncAwaitBeforeThrows() async throws { + await withExpectedIssue { + await Task.yield() + reportIssue() + throw SomeError() + } + } + + @Test func asyncAwaitAfterThrows() async throws { + await withExpectedIssue { + reportIssue() + await Task.yield() + throw SomeError() + } + } + } + + private struct SomeError: Error {} +#endif