Skip to content

Commit

Permalink
add test case in cpp_bootstrap_unittest.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
wangkirin authored and acozzette committed Jul 30, 2019
1 parent bf0c69e commit f38b6ed
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f38b6ed

Please sign in to comment.