diff --git a/test/test_matcher.cpp b/test/test_matcher.cpp index 5f1746d..5a53cb3 100644 --- a/test/test_matcher.cpp +++ b/test/test_matcher.cpp @@ -121,6 +121,11 @@ struct custom_constraint } bool operator()(int actual) { return actual == expected_; } }; + +bool custom_constraint_func(int) +{ + return false; +} } // namespace BOOST_AUTO_TEST_CASE(single_matcher_serializes) @@ -133,6 +138,30 @@ BOOST_AUTO_TEST_CASE(single_matcher_serializes) 1, 2, custom_constraint(), 4, 5)) == "1, 2, custom42, 4, 5"); } +BOOST_AUTO_TEST_CASE(string_matcher_serializes) +{ + using mock::detail::single_matcher; + BOOST_TEST(serialize(single_matcher("foo")) == "\"foo\""); + BOOST_TEST(serialize(single_matcher("foo")) == "\"foo\""); + BOOST_TEST(serialize(single_matcher("foo")) == "\"foo\""); + BOOST_TEST(serialize(single_matcher("foo")) == "\"foo\""); + BOOST_TEST(serialize(single_matcher("foo")) == "\"foo\""); + BOOST_TEST(serialize(single_matcher("foo")) == "\"foo\""); + BOOST_TEST(serialize(single_matcher("foo")) == "\"foo\""); + // Mixed types + BOOST_TEST(serialize(single_matcher("bar", 2)) == "\"bar\", 2"); +} + +BOOST_AUTO_TEST_CASE(functor_matcher_serializes) +{ + using mock::detail::single_matcher; + using Functor = decltype(custom_constraint_func); + BOOST_TEST(serialize(single_matcher(custom_constraint_func)) == "?"); + BOOST_TEST(serialize(single_matcher(custom_constraint_func)) == "?"); + // Mixed types + BOOST_TEST(serialize(single_matcher(custom_constraint_func, 2)) == "?, 2"); +} + BOOST_AUTO_TEST_CASE(multi_matcher_serializes) { using mock::detail::multi_matcher;