Skip to content

Commit

Permalink
Avoid unused function warnings in compile fail tests
Browse files Browse the repository at this point in the history
This avoids false positives when warnings-as-error is enabled
  • Loading branch information
Flamefire committed Jan 7, 2022
1 parent a222bb9 commit 182e070
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 71 deletions.
19 changes: 8 additions & 11 deletions test/fail_constraint_functor_not_compatible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@

#include <turtle/mock.hpp>

namespace
MOCK_CLASS(my_class)
{
MOCK_CLASS( my_class )
{
MOCK_METHOD_EXT( my_method, 1, void( int ), my_method )
};
bool constraint( int, int );
MOCK_METHOD_EXT(my_method, 1, void(int), my_method)
};
bool constraint(int, int) { return true; }

void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).with( &constraint );
}
void test_case()
{
my_class c;
MOCK_EXPECT(c.my_method).with(&constraint);
}
17 changes: 7 additions & 10 deletions test/fail_constraint_value_not_comparable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

#include <turtle/mock.hpp>

namespace
MOCK_CLASS( my_class )
{
MOCK_CLASS( my_class )
{
MOCK_METHOD_EXT( my_method, 1, void( int ), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).with( "42" );
}
MOCK_METHOD_EXT( my_method, 1, void( int ), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).with( "42" );
}
17 changes: 7 additions & 10 deletions test/fail_constraint_value_of_wrong_type_in_builtin_constraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

#include <turtle/mock.hpp>

namespace
MOCK_CLASS( my_class )
{
MOCK_CLASS( my_class )
{
MOCK_METHOD_EXT( my_method, 1, void( int ), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).with( mock::equal( "42" ) );
}
MOCK_METHOD_EXT( my_method, 1, void( int ), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).with( mock::equal( "42" ) );
}
17 changes: 7 additions & 10 deletions test/fail_mismatch_type_in_returns_int_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

#include <turtle/mock.hpp>

namespace
MOCK_CLASS( my_class )
{
MOCK_CLASS( my_class )
{
MOCK_METHOD_EXT( my_method, 0, int(), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).returns( std::string() );
}
MOCK_METHOD_EXT( my_method, 0, int(), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).returns( std::string() );
}
17 changes: 7 additions & 10 deletions test/fail_mismatch_type_in_returns_string_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

#include <turtle/mock.hpp>

namespace
MOCK_CLASS( my_class )
{
MOCK_CLASS( my_class )
{
MOCK_METHOD_EXT( my_method, 0, std::string(), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).returns( 42 );
}
MOCK_METHOD_EXT( my_method, 0, std::string(), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).returns( 42 );
}
17 changes: 7 additions & 10 deletions test/fail_mismatch_type_in_returns_void_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

#include <turtle/mock.hpp>

namespace
MOCK_CLASS( my_class )
{
MOCK_CLASS( my_class )
{
MOCK_METHOD_EXT( my_method, 0, void(), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).returns( "42" );
}
MOCK_METHOD_EXT( my_method, 0, void(), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).returns( "42" );
}
17 changes: 7 additions & 10 deletions test/fail_wrong_number_of_arguments_in_with.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@

#include <turtle/mock.hpp>

namespace
MOCK_CLASS( my_class )
{
MOCK_CLASS( my_class )
{
MOCK_METHOD_EXT( my_method, 1, void( int ), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).with( 42, 42 );
}
MOCK_METHOD_EXT( my_method, 1, void( int ), my_method )
};
void test_case()
{
my_class c;
MOCK_EXPECT( c.my_method ).with( 42, 42 );
}

0 comments on commit 182e070

Please sign in to comment.