File tree Expand file tree Collapse file tree 2 files changed +178
-135
lines changed
Tests/BuildSystemIntegrationTests Expand file tree Collapse file tree 2 files changed +178
-135
lines changed Original file line number Diff line number Diff line change
1
+ //===----------------------------------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2025 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ //===----------------------------------------------------------------------===//
12
+
13
+ public import Testing
14
+
15
+ public func expectThrowsError< T> (
16
+ _ expression: @autoclosure ( ) async throws -> T ,
17
+ _ message: @autoclosure ( ) -> String = " " ,
18
+ sourceLocation: SourceLocation = #_sourceLocation,
19
+ errorHandler: ( _ error: Error ) -> Void = { _ in }
20
+ ) async {
21
+ do {
22
+ _ = try await expression ( )
23
+ Issue . record ( " Expression was expected to throw but did not throw " , sourceLocation: sourceLocation)
24
+ } catch {
25
+ errorHandler ( error)
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments