mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Fixed multiply defined symbol definition for MOCK_FUNCTION included from several translation units
This commit is contained in:
parent
fc8c6bde19
commit
86371b5695
8 changed files with 62 additions and 9 deletions
|
|
@ -19,10 +19,13 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\test\defined.hpp" />
|
||||||
<ClInclude Include="..\..\test\mock_error.hpp" />
|
<ClInclude Include="..\..\test\mock_error.hpp" />
|
||||||
<ClInclude Include="..\..\test\undefined.hpp" />
|
<ClInclude Include="..\..\test\undefined.hpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\test\defined_1.cpp" />
|
||||||
|
<ClCompile Include="..\..\test\defined_2.cpp" />
|
||||||
<ClCompile Include="..\..\test\detail\test_function.cpp" />
|
<ClCompile Include="..\..\test\detail\test_function.cpp" />
|
||||||
<ClCompile Include="..\..\test\detail\test_invocation.cpp" />
|
<ClCompile Include="..\..\test\detail\test_invocation.cpp" />
|
||||||
<ClCompile Include="..\..\test\detail\test_is_functor.cpp" />
|
<ClCompile Include="..\..\test\detail\test_is_functor.cpp" />
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@
|
||||||
<ClInclude Include="..\..\test\undefined.hpp">
|
<ClInclude Include="..\..\test\undefined.hpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\test\defined.hpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\test\test_constraints.cpp">
|
<ClCompile Include="..\..\test\test_constraints.cpp">
|
||||||
|
|
@ -66,5 +69,11 @@
|
||||||
<ClCompile Include="..\..\test\test_exception.cpp">
|
<ClCompile Include="..\..\test\test_exception.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\test\defined_1.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\test\defined_2.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -12,6 +12,7 @@ Not yet released
|
||||||
|
|
||||||
* Fixed missing thread synchronization in mock::sequence
|
* Fixed missing thread synchronization in mock::sequence
|
||||||
* Fixed build errors with Boost 1.59
|
* Fixed build errors with Boost 1.59
|
||||||
|
* Fixed multiply defined symbol definition for MOCK_FUNCTION included from several translation units
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
|
|
||||||
#define MOCK_FUNCTION_AUX(F, n, S, t, s, tpn) \
|
#define MOCK_FUNCTION_AUX(F, n, S, t, s, tpn) \
|
||||||
MOCK_FUNCTION_HELPER(S, t, s, tpn) \
|
MOCK_FUNCTION_HELPER(S, t, s, tpn) \
|
||||||
s inline MOCK_DECL(F, n, S,,tpn) \
|
s MOCK_DECL(F, n, S,,tpn) \
|
||||||
{ \
|
{ \
|
||||||
BOOST_MPL_ASSERT_RELATION( n, ==, \
|
BOOST_MPL_ASSERT_RELATION( n, ==, \
|
||||||
boost::function_types::function_arity< \
|
boost::function_types::function_arity< \
|
||||||
|
|
@ -210,7 +210,8 @@
|
||||||
#define MOCK_FUNCTION(F, n, ...) \
|
#define MOCK_FUNCTION(F, n, ...) \
|
||||||
MOCK_FUNCTION_AUX(F, n, \
|
MOCK_FUNCTION_AUX(F, n, \
|
||||||
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
|
MOCK_VARIADIC_ELEM_0(__VA_ARGS__), \
|
||||||
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, F),,)
|
MOCK_VARIADIC_ELEM_1(__VA_ARGS__, F), \
|
||||||
|
inline,)
|
||||||
|
|
||||||
#define MOCK_STATIC_METHOD(F, n, ...) \
|
#define MOCK_STATIC_METHOD(F, n, ...) \
|
||||||
MOCK_FUNCTION_AUX(F, n, \
|
MOCK_FUNCTION_AUX(F, n, \
|
||||||
|
|
@ -231,10 +232,11 @@
|
||||||
MOCK_METHOD_EXT(M, n, M##_sig_type, M)
|
MOCK_METHOD_EXT(M, n, M##_sig_type, M)
|
||||||
|
|
||||||
#define MOCK_FUNCTION(F, n, S, t) \
|
#define MOCK_FUNCTION(F, n, S, t) \
|
||||||
MOCK_FUNCTION_AUX(F, n, S, t,,)
|
MOCK_FUNCTION_AUX(F, n, S, t, inline,)
|
||||||
|
|
||||||
#define MOCK_STATIC_METHOD(F, n, S, t) \
|
#define MOCK_STATIC_METHOD(F, n, S, t) \
|
||||||
MOCK_FUNCTION_AUX(F, n, S, t, static,)
|
MOCK_FUNCTION_AUX(F, n, S, t, static,)
|
||||||
|
|
||||||
#define MOCK_STATIC_METHOD_TPL(F, n, S, t) \
|
#define MOCK_STATIC_METHOD_TPL(F, n, S, t) \
|
||||||
MOCK_FUNCTION_AUX(F, n, S, t, static, typename)
|
MOCK_FUNCTION_AUX(F, n, S, t, static, typename)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ alias mock_inspect :
|
||||||
|
|
||||||
rule run-test ( name )
|
rule run-test ( name )
|
||||||
{
|
{
|
||||||
run $(name) undefined.cpp /boost//unit_test_framework : : : : $(name)_ ;
|
run $(name) defined_1.cpp defined_2.cpp 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) defined_1.cpp defined_2.cpp 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) defined_1.cpp defined_2.cpp 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) defined_1.cpp defined_2.cpp 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) defined_1.cpp defined_2.cpp 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 /boost//thread : : : <define>MOCK_THREAD_SAFE <define>BOOST_THREAD_USES_MOVE <threading>multi : $(name)_thread_safe ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule run-tests
|
rule run-tests
|
||||||
|
|
|
||||||
20
test/defined.hpp
Normal file
20
test/defined.hpp
Normal 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
9
test/defined_1.cpp
Normal 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
9
test/defined_2.cpp
Normal 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"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue