diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2018-08-08 17:00:41 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2018-08-08 17:00:41 -0700 |
commit | 6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 (patch) | |
tree | e575738adf52d24b883cca5e8928a5ded31caba1 /src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc | |
parent | e7746f487cb9cca685ffb1b3d7dccc5554b618a4 (diff) | |
download | protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.gz protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.tar.bz2 protobuf-6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3.zip |
Down-integrate from google3.
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc')
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc index 24f1fe45..4c135649 100644 --- a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -32,7 +32,7 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. // -// This test insures that google/protobuf/descriptor.pb.{h,cc} match exactly +// This test insures that net/proto2/proto/descriptor.pb.{h,cc} match exactly // what would be generated by the protocol compiler. These files are not // generated automatically at build time because they are compiled into the // protocol compiler itself. So, if they were auto-generated, you'd have a @@ -47,6 +47,7 @@ #include <google/protobuf/compiler/cpp/cpp_helpers.h> #include <google/protobuf/compiler/cpp/cpp_generator.h> #include <google/protobuf/compiler/importer.h> +#include <google/protobuf/test_util2.h> #include <google/protobuf/io/zero_copy_stream_impl.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/stubs/substitute.h> @@ -83,9 +84,7 @@ class MockErrorCollector : public MultiFileErrorCollector { class MockGeneratorContext : public GeneratorContext { public: MockGeneratorContext() {} - ~MockGeneratorContext() { - STLDeleteValues(&files_); - } + ~MockGeneratorContext() { STLDeleteValues(&files_); } void ExpectFileMatches(const string& virtual_filename, const string& physical_filename) { @@ -95,9 +94,11 @@ class MockGeneratorContext : public GeneratorContext { string actual_contents; GOOGLE_CHECK_OK( - File::GetContentsAsText(TestSourceDir() + "/" + physical_filename, - &actual_contents, true)); - EXPECT_TRUE(actual_contents == *expected_contents) + File::GetContents(TestUtil::TestSourceDir() + "/" + physical_filename, + &actual_contents, true)) + << physical_filename; + CleanStringLineEndings(&actual_contents, false); + EXPECT_EQ(*expected_contents, actual_contents) << physical_filename << " needs to be regenerated. Please run " "generate_descriptor_proto.sh. " @@ -136,11 +137,11 @@ TEST(BootstrapTest, GeneratedFilesMatch) { "net/proto2/z_generated_example/test_messages_proto2"; rpath_map["third_party/protobuf/src/google/protobuf/test_messages_proto3"] = "net/proto2/z_generated_example/test_messages_proto3"; - rpath_map["google/protobuf/proto2_weak"] = + rpath_map["net/proto2/internal/proto2_weak"] = "net/proto2/z_generated_example/proto2_weak"; DiskSourceTree source_tree; - source_tree.MapPath("", TestSourceDir()); + source_tree.MapPath("", TestUtil::TestSourceDir()); for (auto file_parameter : test_protos) { MockErrorCollector error_collector; |