MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / test_exceptions_custom

Method test_exceptions_custom

test/test_core.py:1194–1234  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1192
1193 @with_all_eh_sjlj
1194 def test_exceptions_custom(self):
1195 self.set_setting('EXCEPTION_DEBUG')
1196 self.maybe_closure()
1197 src = r'''
1198 #include <iostream>
1199
1200 class MyException {
1201 public:
1202 MyException(){ std::cout << "Construct..."; }
1203 MyException( const MyException & ) { std::cout << "Copy..."; }
1204 ~MyException(){ std::cout << "Destruct..."; }
1205 };
1206
1207 int function() {
1208 std::cout << "Throw...";
1209 throw MyException();
1210 }
1211
1212 int function2() {
1213 return function();
1214 }
1215
1216 int main() {
1217 try {
1218 function2();
1219 } catch (MyException & e) {
1220 std::cout << "Caught...";
1221 }
1222
1223 try {
1224 function2();
1225 } catch (MyException e) {
1226 std::cout << "Caught...";
1227 }
1228
1229 std::cout << "\n";
1230 return 0;
1231 }
1232 ''&#x27;
1233
1234 self.do_run(src, 'Throw...Construct...Caught...Destruct...Throw...Construct...Copy...Caught...Destruct...Destruct...\n')
1235
1236 @with_all_eh_sjlj
1237 def test_exceptions_2(self):

Callers

nothing calls this directly

Calls 3

maybe_closureMethod · 0.95
do_runMethod · 0.95
set_settingMethod · 0.80

Tested by

no test coverage detected