Skip to content

Commit

Permalink
Merge branch 'topic/GH-263-header-variant-test-no-lib' into next-inte…
Browse files Browse the repository at this point in the history
…rnal
  • Loading branch information
raffienficiaud committed Apr 6, 2020
2 parents 2f79bff + c7ebd4e commit 0d74309
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
1 change: 1 addition & 0 deletions doc/closing_chapters/change_log.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Boost.Test releases:
# [github_issue 251] Context message are always printed if both HRF and Junit loggers are enabled
# [github_issue 253] Invalid XML log is generated by `BOOST_AUTO_TEST_CASE_TEMPLATE` when tests are skipped
# [github_issue 254] Console colors are not restored on Windows
# [github_issue 263] Windows: Header-only mode with multiple translation units requires `BOOST_TEST_NO_LIB`

# [pull_request 41] Fix: activate virtual destructors for all `msvc` versions
# [pull_request 114] Silence unreachable code warning in MSVC (`/W4`)
Expand Down
3 changes: 2 additions & 1 deletion include/boost/test/unit_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
// ************************************************************************** //

#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_TEST_NO_LIB) && \
!defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED)
!defined(BOOST_TEST_SOURCE) && !defined(BOOST_TEST_INCLUDED) && \
defined(BOOST_TEST_MAIN)
# define BOOST_LIB_NAME boost_unit_test_framework

# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TEST_DYN_LINK)
Expand Down
17 changes: 16 additions & 1 deletion test/usage-variants-ts/single-header-multiunit-1-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@
// Description : header-only usage variant with multiple translation units test
// ***************************************************************************

// Boost.Test
// this test requires that the linking has not been manipulated
// Since this is way impossible to make it work from B2, the undef of the
// auto linking variables is done here in the source.
// should be done before any include and in all translation units
#if defined(BOOST_TEST_NO_LIB)
#undef BOOST_TEST_NO_LIB
#endif

#if defined(BOOST_ALL_NO_LIB)
#undef BOOST_ALL_NO_LIB
#endif

#define BOOST_TEST_MODULE header-only multiunit test
#include <boost/test/included/unit_test.hpp>

#if defined(BOOST_TEST_NO_LIB) || defined(BOOST_ALL_NO_LIB)
#error BOOST_TEST_NO_LIB/BOOST_ALL_NO_LIB defined (post boost inclusion)!!
#endif

BOOST_AUTO_TEST_CASE( test1 )
{
int i = 1;
Expand Down
25 changes: 18 additions & 7 deletions test/usage-variants-ts/single-header-multiunit-2-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,28 @@
// http://www.boost.org/LICENSE_1_0.txt)

// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision$
//
// Description : header-only usage variant test

// Description : header-only usage variant with multiple translation units test
// ***************************************************************************

// Boost.Test
// this test requires that the linking has not been manipulated
// Since this is way impossible to make it work from B2, the undef of the
// auto linking variables is done here in the source.
// should be done before any include and in all translation units
#if defined(BOOST_TEST_NO_LIB)
#undef BOOST_TEST_NO_LIB
#endif

#if defined(BOOST_ALL_NO_LIB)
#undef BOOST_ALL_NO_LIB
#endif

#include <boost/test/unit_test.hpp>

#if defined(BOOST_TEST_NO_LIB) || defined(BOOST_ALL_NO_LIB)
#error BOOST_TEST_NO_LIB/BOOST_ALL_NO_LIB defined (post boost inclusion)!!
#endif

BOOST_AUTO_TEST_CASE( test2 )
{
int i = 1;
Expand Down

0 comments on commit 0d74309

Please sign in to comment.