diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-07-20 21:16:35 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-07-20 21:16:35 +0000 |
commit | 387bdd551d4a88383246841ac3f70324b8d42772 (patch) | |
tree | c7dd4842fadddd0671feb380be95eeba6ca6070a /test/gmock-generated-actions_test.cc | |
parent | b5937dab6969ca4b1d8304cc8939ce16c1fb62e5 (diff) | |
download | googletest-387bdd551d4a88383246841ac3f70324b8d42772.tar.gz googletest-387bdd551d4a88383246841ac3f70324b8d42772.tar.bz2 googletest-387bdd551d4a88383246841ac3f70324b8d42772.zip |
Makes ByRef(x) printable as a reference to x.
Diffstat (limited to 'test/gmock-generated-actions_test.cc')
-rw-r--r-- | test/gmock-generated-actions_test.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/gmock-generated-actions_test.cc b/test/gmock-generated-actions_test.cc index d0b2ddc9..cf3c7891 100644 --- a/test/gmock-generated-actions_test.cc +++ b/test/gmock-generated-actions_test.cc @@ -36,6 +36,7 @@ #include <gmock/gmock-generated-actions.h> #include <functional> +#include <sstream> #include <string> #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -546,6 +547,15 @@ TEST(ByRefTest, ExplicitType) { // ByRef<Derived>(b); } +// Tests that Google Mock prints expression ByRef(x) as a reference to x. +TEST(ByRefTest, PrintsCorrectly) { + int n = 42; + ::std::stringstream expected, actual; + testing::internal::UniversalPrinter<const int&>::Print(n, &expected); + testing::internal::UniversalPrint(ByRef(n), &actual); + EXPECT_EQ(expected.str(), actual.str()); +} + // Tests InvokeArgument<N>(...). // Tests using InvokeArgument with a nullary function. |