Skip to content

Commit 7801adf

Browse files
committed
[interop] test, runtime test for protocol witness / thunk trap on uncaught exception
1 parent 613e545 commit 7801adf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/Interop/Cxx/exceptions/trap-on-exception-execution.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,25 @@ TrapOnExecutionTestSuite.test("TestTemplateBoolDependentNoExceptMethod") {
6767
v.dependentNoExceptMethod()
6868
}
6969

70+
protocol MethodProtocol {
71+
func method(_ x: CInt) -> CInt
72+
}
73+
74+
extension TestClass: MethodProtocol {
75+
}
76+
77+
TrapOnExecutionTestSuite.test("TestProtocolConformanceThunkInvoke") {
78+
let v = TestClass()
79+
let p: MethodProtocol = v
80+
expectCrashLater()
81+
let _ = p.method(2)
82+
}
83+
84+
TrapOnExecutionTestSuite.test("TestClassWithSubscript") {
85+
let v = ClassWithSubscript()
86+
expectEqual(v[0], 0)
87+
expectCrashLater()
88+
let _ = v[1]
89+
}
90+
7091
runAllTests()

0 commit comments

Comments
 (0)