First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Name : terminate_handler_test.cpp
15 // Part of : standard c++ tests.
20 #include "test_decls.h"
29 throw int (0); // This causes std::terminate to be called since the
30 // destructor is throwing while someone is unwinding the stack.
31 // Since we ahve the terminate_handler set, my_handler must get called.
38 throw int (1); // causes stack unwinding - hence calls ~UserClass()
51 CPP_TESTS_ASSERT_ALLWAYS(1);
57 std::terminate_handler h_old, h_new;
58 h_new = (std::terminate_handler)&my_handler;
59 h_old = std::set_terminate(h_new);
63 //Failed to call terminate handler
64 CPP_TESTS_ASSERT_ALLWAYS(0);