Fixed multiply defined symbol definition for MOCK_FUNCTION included from several translation units

This commit is contained in:
Mathieu Champlon 2015-08-10 18:21:40 +02:00
parent fc8c6bde19
commit 86371b5695
8 changed files with 62 additions and 9 deletions

View file

@ -25,12 +25,12 @@ alias mock_inspect :
rule run-test ( name )
{
run $(name) undefined.cpp /boost//unit_test_framework : : : : $(name)_ ;
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_MAX_ARGS=21 : $(name)_max_args ;
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_USE_CONVERSIONS : $(name)_use_conversions ;
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_DECLTYPE : $(name)_no_decltype ;
run $(name) undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_VARIADIC_MACROS : $(name)_no_variadic_macros ;
run $(name) undefined.cpp /boost//unit_test_framework /boost//thread : : : <define>MOCK_THREAD_SAFE <define>BOOST_THREAD_USES_MOVE <threading>multi : $(name)_thread_safe ;
run $(name) defined_1.cpp defined_2.cpp undefined.cpp /boost//unit_test_framework : : : : $(name)_ ;
run $(name) defined_1.cpp defined_2.cpp undefined.cpp /boost//unit_test_framework : : : <define>MOCK_MAX_ARGS=21 : $(name)_max_args ;
run $(name) defined_1.cpp defined_2.cpp undefined.cpp /boost//unit_test_framework : : : <define>MOCK_USE_CONVERSIONS : $(name)_use_conversions ;
run $(name) defined_1.cpp defined_2.cpp undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_DECLTYPE : $(name)_no_decltype ;
run $(name) defined_1.cpp defined_2.cpp undefined.cpp /boost//unit_test_framework : : : <define>MOCK_NO_VARIADIC_MACROS : $(name)_no_variadic_macros ;
run $(name) defined_1.cpp defined_2.cpp undefined.cpp /boost//unit_test_framework /boost//thread : : : <define>MOCK_THREAD_SAFE <define>BOOST_THREAD_USES_MOVE <threading>multi : $(name)_thread_safe ;
}
rule run-tests

20
test/defined.hpp Normal file
View file

@ -0,0 +1,20 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2015
//
// 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)
#ifndef MOCK_TEST_DEFINED_HPP_INCLUDED
#define MOCK_TEST_DEFINED_HPP_INCLUDED
#ifdef BOOST_AUTO_TEST_MAIN
#undef BOOST_AUTO_TEST_MAIN
#endif
#include <turtle/mock.hpp>
MOCK_FUNCTION( f, 0, void(), f )
#endif // MOCK_TEST_DEFINED_HPP_INCLUDED

9
test/defined_1.cpp Normal file
View file

@ -0,0 +1,9 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2015
//
// 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)
#include "defined.hpp"

9
test/defined_2.cpp Normal file
View file

@ -0,0 +1,9 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2015
//
// 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)
#include "defined.hpp"