root/library/tests/unittest-cpp/ExecuteTest.h @ 477

Revision 477, 1.0 kB (checked in by mido, 15 years ago)

panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc

RevLine 
[418]1#ifndef UNITTEST_EXECUTE_TEST_H
2#define UNITTEST_EXECUTE_TEST_H
3
4#include "TestDetails.h"
5#include "MemoryOutStream.h"
6#include "AssertException.h"
7#include "CurrentTest.h"
8
9#ifdef UNITTEST_POSIX
[477]10#include "Posix/SignalTranslator.h"
[418]11#endif
12
13namespace UnitTest {
14
15template< typename T >
[477]16void ExecuteTest ( T& testObject, TestDetails const& details ) {
[418]17        CurrentTest::Details() = &details;
18
[477]19        try {
[418]20#ifdef UNITTEST_POSIX
21                UNITTEST_THROW_SIGNALS
22#endif
23                testObject.RunImpl();
[477]24        } catch ( AssertException const& e ) {
25                CurrentTest::Results()->OnTestFailure (
26                    TestDetails ( details.testName, details.suiteName, e.Filename(), e.LineNumber() ), e.what() );
27        } catch ( std::exception const& e ) {
[418]28                MemoryOutStream stream;
29                stream << "Unhandled exception: " << e.what();
[477]30                CurrentTest::Results()->OnTestFailure ( details, stream.GetText() );
31        } catch ( ... ) {
32                CurrentTest::Results()->OnTestFailure ( details, "Unhandled exception: Crash!" );
[418]33        }
34}
35
36}
37
38#endif
Note: See TracBrowser for help on using the browser.