diff options
Diffstat (limited to 'src/google/protobuf/io/printer_unittest.cc')
-rw-r--r-- | src/google/protobuf/io/printer_unittest.cc | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/google/protobuf/io/printer_unittest.cc b/src/google/protobuf/io/printer_unittest.cc index 1331a8d..580a53d 100644 --- a/src/google/protobuf/io/printer_unittest.cc +++ b/src/google/protobuf/io/printer_unittest.cc @@ -1,6 +1,6 @@ // Protocol Buffers - Google's data interchange format // Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ +// http://code.google.com/p/protobuf/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -220,7 +220,7 @@ TEST(Printer, Indenting) { } // Death tests do not work on Windows as of yet. -#ifdef PROTOBUF_HAS_DEATH_TEST +#ifdef GTEST_HAS_DEATH_TEST TEST(Printer, Death) { char buffer[8192]; @@ -231,33 +231,9 @@ TEST(Printer, Death) { EXPECT_DEBUG_DEATH(printer.Print("$unclosed"), "Unclosed variable name"); EXPECT_DEBUG_DEATH(printer.Outdent(), "without matching Indent"); } -#endif // PROTOBUF_HAS_DEATH_TEST +#endif // GTEST_HAS_DEATH_TEST -TEST(Printer, WriteFailurePartial) { - char buffer[17]; - - ArrayOutputStream output(buffer, sizeof(buffer)); - Printer printer(&output, '$'); - - // Print 16 bytes to almost fill the buffer (should not fail). - printer.Print("0123456789abcdef"); - EXPECT_FALSE(printer.failed()); - - // Try to print 2 chars. Only one fits. - printer.Print("<>"); - EXPECT_TRUE(printer.failed()); - - // Anything else should fail too. - printer.Print(" "); - EXPECT_TRUE(printer.failed()); - printer.Print("blah"); - EXPECT_TRUE(printer.failed()); - - // Buffer should contain the first 17 bytes written. - EXPECT_EQ("0123456789abcdef<", string(buffer, sizeof(buffer))); -} - -TEST(Printer, WriteFailureExact) { +TEST(Printer, WriteFailure) { char buffer[16]; ArrayOutputStream output(buffer, sizeof(buffer)); |