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/descriptor_database_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/descriptor_database_unittest.cc')
-rw-r--r-- | src/google/protobuf/descriptor_database_unittest.cc | 18 |
1 files changed, 17 insertions, 1 deletions
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 <google/protobuf/stubs/logging.h> #include <google/protobuf/stubs/common.h> +#include <gmock/gmock.h> #include <google/protobuf/testing/googletest.h> #include <gtest/gtest.h> @@ -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<string> all_files; + db.FindAllFileNames(&all_files); + EXPECT_THAT(all_files, testing::ElementsAre("foo.proto")); +} + // =================================================================== class MergedDescriptorDatabaseTest : public testing::Test { |