From 6bbe197e9c1b6fc38cbdc45e3bf83fa7ced792a3 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Wed, 8 Aug 2018 17:00:41 -0700 Subject: Down-integrate from google3. --- src/google/protobuf/descriptor_database_unittest.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/google/protobuf/descriptor_database_unittest.cc') diff --git a/src/google/protobuf/descriptor_database_unittest.cc b/src/google/protobuf/descriptor_database_unittest.cc index 083ef8f2..7d3f17ca 100644 --- a/src/google/protobuf/descriptor_database_unittest.cc +++ b/src/google/protobuf/descriptor_database_unittest.cc @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -77,7 +78,7 @@ static void ExpectContainsType(const FileDescriptorProto& proto, // three nearly-identical sets of tests, we use parameterized tests to apply // the same code to all three. -// The parameterized test runs against a DescriptarDatabaseTestCase. We have +// The parameterized test runs against a DescriptorDatabaseTestCase. We have // implementations for each of the three classes we want to test. class DescriptorDatabaseTestCase { public: @@ -519,6 +520,21 @@ TEST(EncodedDescriptorDatabaseExtraTest, FindNameOfFileContainingSymbol) { EXPECT_FALSE(db.FindNameOfFileContainingSymbol("baz.Baz", &filename)); } +TEST(SimpleDescriptorDatabaseExtraTest, FindAllFileNames) { + FileDescriptorProto f; + f.set_name("foo.proto"); + f.set_package("foo"); + f.add_message_type()->set_name("Foo"); + + SimpleDescriptorDatabase db; + db.Add(f); + + // Test! + std::vector all_files; + db.FindAllFileNames(&all_files); + EXPECT_THAT(all_files, testing::ElementsAre("foo.proto")); +} + // =================================================================== class MergedDescriptorDatabaseTest : public testing::Test { -- cgit v1.2.3