aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock_output_test_.cc
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2018-08-16 11:13:12 -0400
committerGitHub <noreply@github.com>2018-08-16 11:13:12 -0400
commit21e518557ad7634bc4b1fd57effa7e49a1405bb5 (patch)
tree8484ccd28cc1bb4aa27c3b47b9a56cf9ee2ce66c /googlemock/test/gmock_output_test_.cc
parent3e2cb75446e0f56f226f0fb259e032bb4d014002 (diff)
parent490554aa0f3618e1e5dd217f11fe0c3f188ed615 (diff)
downloadgoogletest-21e518557ad7634bc4b1fd57effa7e49a1405bb5.tar.gz
googletest-21e518557ad7634bc4b1fd57effa7e49a1405bb5.tar.bz2
googletest-21e518557ad7634bc4b1fd57effa7e49a1405bb5.zip
Merge branch 'master' into josh/fix_scoped_class2
Diffstat (limited to 'googlemock/test/gmock_output_test_.cc')
-rw-r--r--googlemock/test/gmock_output_test_.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/googlemock/test/gmock_output_test_.cc b/googlemock/test/gmock_output_test_.cc
index 44cba342..3955c733 100644
--- a/googlemock/test/gmock_output_test_.cc
+++ b/googlemock/test/gmock_output_test_.cc
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: wan@google.com (Zhanyong Wan)
+
// Tests Google Mock's output in various scenarios. This ensures that
// Google Mock's messages are readable and useful.
@@ -39,6 +38,12 @@
#include "gtest/gtest.h"
+// Silence C4100 (unreferenced formal parameter)
+#ifdef _MSC_VER
+# pragma warning(push)
+# pragma warning(disable:4100)
+#endif
+
using testing::_;
using testing::AnyNumber;
using testing::Ge;
@@ -47,6 +52,7 @@ using testing::NaggyMock;
using testing::Ref;
using testing::Return;
using testing::Sequence;
+using testing::Value;
class MockFoo {
public:
@@ -268,6 +274,15 @@ TEST_F(GMockOutputTest, CatchesLeakedMocks) {
// Both foo1 and foo2 are deliberately leaked.
}
+MATCHER_P2(IsPair, first, second, "") {
+ return Value(arg.first, first) && Value(arg.second, second);
+}
+
+TEST_F(GMockOutputTest, PrintsMatcher) {
+ const testing::Matcher<int> m1 = Ge(48);
+ EXPECT_THAT((std::pair<int, bool>(42, true)), IsPair(m1, true));
+}
+
void TestCatchesLeakedMocksInAdHocTests() {
MockFoo* foo = new MockFoo;
@@ -280,7 +295,6 @@ void TestCatchesLeakedMocksInAdHocTests() {
int main(int argc, char **argv) {
testing::InitGoogleMock(&argc, argv);
-
// Ensures that the tests pass no matter what value of
// --gmock_catch_leaked_mocks and --gmock_verbose the user specifies.
testing::GMOCK_FLAG(catch_leaked_mocks) = true;
@@ -289,3 +303,7 @@ int main(int argc, char **argv) {
TestCatchesLeakedMocksInAdHocTests();
return RUN_ALL_TESTS();
}
+
+#ifdef _MSC_VER
+# pragma warning(pop)
+#endif