aboutsummaryrefslogtreecommitdiffstats
path: root/test/gtest_output_test_.cc
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2012-06-07 20:34:34 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2012-06-07 20:34:34 +0000
commita88c9a88e49e90ec414175543b2b7ff2f70866a7 (patch)
tree617807532cbbd68ce8e684a570791231b1b9cd92 /test/gtest_output_test_.cc
parenta3b859162dd7a4a1798cf8753a03098f2cbdb62e (diff)
downloadgoogletest-a88c9a88e49e90ec414175543b2b7ff2f70866a7.tar.gz
googletest-a88c9a88e49e90ec414175543b2b7ff2f70866a7.tar.bz2
googletest-a88c9a88e49e90ec414175543b2b7ff2f70866a7.zip
Improves gtest's failure messages. In particulars, char pointers and
char arrays are not escapped properly.
Diffstat (limited to 'test/gtest_output_test_.cc')
-rw-r--r--test/gtest_output_test_.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc
index 1b08b65b..da8b7449 100644
--- a/test/gtest_output_test_.cc
+++ b/test/gtest_output_test_.cc
@@ -27,8 +27,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
-// A unit test for Google Test itself. This verifies that the basic
-// constructs of Google Test work.
+// The purpose of this file is to generate Google Test output under
+// various conditions. The output will then be verified by
+// gtest_output_test.py to ensure that Google Test generates the
+// desired messages. Therefore, most tests in this file are MEANT TO
+// FAIL.
//
// Author: wan@google.com (Zhanyong Wan)
@@ -101,6 +104,16 @@ INSTANTIATE_TEST_CASE_P(PrintingFailingParams,
FailingParamTest,
testing::Values(2));
+static const char kGoldenString[] = "\"Line\0 1\"\nLine 2";
+
+TEST(NonfatalFailureTest, EscapesStringOperands) {
+ std::string actual = "actual \"string\"";
+ EXPECT_EQ(kGoldenString, actual);
+
+ const char* golden = kGoldenString;
+ EXPECT_EQ(golden, actual);
+}
+
// Tests catching a fatal failure in a subroutine.
TEST(FatalFailureTest, FatalFailureInSubroutine) {
printf("(expecting a failure that x should be 1)\n");