From 182e070d5b883dd4971db0b5a141a898d3146174 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 7 Jan 2022 18:13:19 +0100 Subject: [PATCH] Avoid unused function warnings in compile fail tests This avoids false positives when warnings-as-error is enabled --- ...fail_constraint_functor_not_compatible.cpp | 19 ++++++++----------- test/fail_constraint_value_not_comparable.cpp | 17 +++++++---------- ...ue_of_wrong_type_in_builtin_constraint.cpp | 17 +++++++---------- ...il_mismatch_type_in_returns_int_action.cpp | 17 +++++++---------- ...mismatch_type_in_returns_string_action.cpp | 17 +++++++---------- ...l_mismatch_type_in_returns_void_action.cpp | 17 +++++++---------- ...fail_wrong_number_of_arguments_in_with.cpp | 17 +++++++---------- 7 files changed, 50 insertions(+), 71 deletions(-) diff --git a/test/fail_constraint_functor_not_compatible.cpp b/test/fail_constraint_functor_not_compatible.cpp index 51558eb5..e3d6aed1 100644 --- a/test/fail_constraint_functor_not_compatible.cpp +++ b/test/fail_constraint_functor_not_compatible.cpp @@ -8,17 +8,14 @@ #include -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); } diff --git a/test/fail_constraint_value_not_comparable.cpp b/test/fail_constraint_value_not_comparable.cpp index 0d0ef8ca..dec09ac1 100644 --- a/test/fail_constraint_value_not_comparable.cpp +++ b/test/fail_constraint_value_not_comparable.cpp @@ -8,15 +8,12 @@ #include -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" ); } diff --git a/test/fail_constraint_value_of_wrong_type_in_builtin_constraint.cpp b/test/fail_constraint_value_of_wrong_type_in_builtin_constraint.cpp index f54013c1..8d18b823 100644 --- a/test/fail_constraint_value_of_wrong_type_in_builtin_constraint.cpp +++ b/test/fail_constraint_value_of_wrong_type_in_builtin_constraint.cpp @@ -8,15 +8,12 @@ #include -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" ) ); } diff --git a/test/fail_mismatch_type_in_returns_int_action.cpp b/test/fail_mismatch_type_in_returns_int_action.cpp index 11478572..c4a5aed4 100644 --- a/test/fail_mismatch_type_in_returns_int_action.cpp +++ b/test/fail_mismatch_type_in_returns_int_action.cpp @@ -8,15 +8,12 @@ #include -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() ); } diff --git a/test/fail_mismatch_type_in_returns_string_action.cpp b/test/fail_mismatch_type_in_returns_string_action.cpp index 103613f6..885a4ac2 100644 --- a/test/fail_mismatch_type_in_returns_string_action.cpp +++ b/test/fail_mismatch_type_in_returns_string_action.cpp @@ -8,15 +8,12 @@ #include -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 ); } diff --git a/test/fail_mismatch_type_in_returns_void_action.cpp b/test/fail_mismatch_type_in_returns_void_action.cpp index 68b774c4..d3dd35c6 100644 --- a/test/fail_mismatch_type_in_returns_void_action.cpp +++ b/test/fail_mismatch_type_in_returns_void_action.cpp @@ -8,15 +8,12 @@ #include -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" ); } diff --git a/test/fail_wrong_number_of_arguments_in_with.cpp b/test/fail_wrong_number_of_arguments_in_with.cpp index dc3420fb..033ffd82 100644 --- a/test/fail_wrong_number_of_arguments_in_with.cpp +++ b/test/fail_wrong_number_of_arguments_in_with.cpp @@ -8,15 +8,12 @@ #include -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 ); }