(self)
| 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 | ''' |
| 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): |
nothing calls this directly
no test coverage detected