mirror of
https://github.com/boostorg/test.git
synced 2026-02-02 21:22:10 +00:00
- new macros: BOOST_TEST_GLOBAL_FIXTURE: for global "real" fixtures BOOST_TEST_GLOBAL_CONFIGURATION: for global configuration of observers. - deprecating BOOST_GLOBAL_FIXTURE. BOOST_GLOBAL_FIXTURE and BOOST_TEST_GLOBAL_CONFIGURATION are currently fully equivalent, the former being confusing in term of scope/role is deprecated - SFINAE detection for a setup/teardown function within the fixture class - Attaching global fixture to the main or master test unit being executed, exactly as other fixtures. Global fixtures via BOOST_TEST_GLOBAL_FIXTURE registers themselves in a particular field of the framework and are attached each time the framework executes the tests, such that we can run the framework on another test root and still benefit from the global fixtures. The global fixtures are appended to already existing fixtures (in case the master test suite is not the root of the current execution tree). - Checking that the framework setup is not failing for running the test - RAII class for restoring the global fixtures - Tests on the setup/teardown detection - Tests on global fixtures and baseline - Fixing several logging issues Some additional refactoring - renaming m_curr_test_case to m_curr_test_unit - function for providing the current test unit (and not only the current test case) - for output_stream comparison: stops properly if the reference stream is shorter than the current one, initialises the read char correctly to 0 and prints a proper ~ at the mismatch location
64 lines
2.0 KiB
C++
64 lines
2.0 KiB
C++
// (c) Copyright Raffi Enficiaud 2017.
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
// See http://www.boost.org/libs/test for the library home page.
|
|
//
|
|
/// @file
|
|
/// @brief Defines an observer that monitors the init of the unit test framework
|
|
// ***************************************************************************
|
|
|
|
#ifndef BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER
|
|
#define BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER
|
|
|
|
// Boost.Test
|
|
#include <boost/test/tree/observer.hpp>
|
|
|
|
#include <boost/test/detail/global_typedef.hpp>
|
|
#include <boost/test/detail/fwd_decl.hpp>
|
|
|
|
#include <boost/test/utils/trivial_singleton.hpp>
|
|
|
|
#include <boost/test/detail/suppress_warnings.hpp>
|
|
|
|
//____________________________________________________________________________//
|
|
|
|
namespace boost {
|
|
namespace unit_test {
|
|
|
|
// ************************************************************************** //
|
|
/// @brief Monitors the init of the framework
|
|
///
|
|
/// This class collects the state of the init/termination of the unit test framework.
|
|
///
|
|
/// @see boost::unit_test::test_observer
|
|
class BOOST_TEST_DECL framework_init_observer_t : public test_observer, public singleton<framework_init_observer_t> {
|
|
public:
|
|
|
|
virtual void test_start( counter_t );
|
|
|
|
virtual void assertion_result( unit_test::assertion_result );
|
|
virtual void exception_caught( execution_exception const& );
|
|
virtual void test_aborted();
|
|
|
|
virtual int priority() { return 0; }
|
|
|
|
void clear();
|
|
|
|
/// Indicates if a failure has been recorded so far
|
|
bool has_failed( ) const;
|
|
|
|
private:
|
|
BOOST_TEST_SINGLETON_CONS( framework_init_observer_t )
|
|
};
|
|
|
|
BOOST_TEST_SINGLETON_INST( framework_init_observer )
|
|
|
|
} // namespace unit_test
|
|
} // namespace boost
|
|
|
|
#include <boost/test/detail/enable_warnings.hpp>
|
|
|
|
#endif // BOOST_TEST_FRAMEWORK_INIT_OBSERVER_HPP_071894GER
|