@with_both_exception_handling
def test_exceptions_custom(self):
    self.set_setting('EXCEPTION_DEBUG', 1)
    self.set_setting('EXIT_RUNTIME', 1)
    self.maybe_closure()
    src = '\n    #include <iostream>\n\n    class MyException\n    {\n    public:\n        MyException(){ std::cout << "Construct..."; }\n        MyException( const MyException & ) { std::cout << "Copy..."; }\n        ~MyException(){ std::cout << "Destruct..."; }\n    };\n\n    int function()\n    {\n        std::cout << "Throw...";\n        throw MyException();\n    }\n\n    int function2()\n    {\n        return function();\n    }\n\n    int main()\n    {\n        try\n        {\n            function2();\n        }\n        catch (MyException & e)\n        {\n            std::cout << "Caught...";\n        }\n\n        try\n        {\n            function2();\n        }\n        catch (MyException e)\n        {\n            std::cout << "Caught...";\n        }\n\n        return 0;\n    }\n    '
    self.do_run(src, 'Throw...Construct...Caught...Destruct...Throw...Construct...Copy...Caught...Destruct...Destruct...')
@with_both_exception_handling
def test_exceptions_custom(self):
    self.set_setting('EXCEPTION_DEBUG', 1)
    self.set_setting('EXIT_RUNTIME', 1)
    self.maybe_closure()
    src = '\n    #include <iostream>\n\n    class MyException\n    {\n    public:\n        MyException(){ std::cout << "Construct..."; }\n        MyException( const MyException & ) { std::cout << "Copy..."; }\n        ~MyException(){ std::cout << "Destruct..."; }\n    };\n\n    int function()\n    {\n        std::cout << "Throw...";\n        throw MyException();\n    }\n\n    int function2()\n    {\n        return function();\n    }\n\n    int main()\n    {\n        try\n        {\n            function2();\n        }\n        catch (MyException & e)\n        {\n            std::cout << "Caught...";\n        }\n\n        try\n        {\n            function2();\n        }\n        catch (MyException e)\n        {\n            std::cout << "Caught...";\n        }\n\n        return 0;\n    }\n    '
    self.do_run(src, 'Throw...Construct...Caught...Destruct...Throw...Construct...Copy...Caught...Destruct...Destruct...')