From f38b6ed041107330b7453def5139438b0b3e5978 Mon Sep 17 00:00:00 2001 From: Wang Kirin Date: Tue, 30 Jul 2019 08:49:13 +0800 Subject: [PATCH] add test case in cpp_bootstrap_unittest.cc --- .../protobuf/compiler/cpp/cpp_bootstrap_unittest.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) mode change 100644 => 100755 src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc diff --git a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc old mode 100644 new mode 100755 index ef5be0365c..3e2b3ce275 --- a/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc +++ b/src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc @@ -178,6 +178,19 @@ TEST(BootstrapTest, GeneratedFilesMatch) { } } +//test Generate in cpp_generator.cc +TEST(BootstrapTest, OptionNotExist) +{ + cpp::CppGenerator generator; + DescriptorPool pool; + GeneratorContext *generator_context = nullptr; + std::string parameter = "aaa"; + string error; + ASSERT_FALSE(generator.Generate(pool.FindFileByName("google/protobuf/descriptor.proto"), + parameter, generator_context, &error)); + EXPECT_EQ(error, "Unknown generator option: " + parameter); +} + } // namespace } // namespace cpp