Skip to content

Commit 7c7a976

Browse files
committed
Add a test for try! location reporting
1 parent 5f17e64 commit 7c7a976

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/stdlib/Error.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,18 @@ ErrorTests.test("try!")
115115
.code {
116116
expectCrashLater()
117117
let _: () = try! { throw SillyError.JazzHands }()
118-
}
118+
}
119+
120+
ErrorTests.test("try!/location")
121+
.skip(.custom({ _isFastAssertConfiguration() },
122+
reason: "trap is not guaranteed to happen in -Ounchecked"))
123+
.crashOutputMatches(_isDebugAssertConfiguration()
124+
? "test/stdlib/Error.swift, line 128"
125+
: "")
126+
.code {
127+
expectCrashLater()
128+
let _: () = try! { throw SillyError.JazzHands }()
129+
}
119130

120131
ErrorTests.test("try?") {
121132
var value = try? { () throws -> Int in return 1 }()

0 commit comments

Comments
 (0)