From d36c0c538a545fac5d9db6ba65c525246d4efa95 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Wed, 29 Mar 2017 14:32:48 -0700 Subject: Down-integrate from google3. --- .../compiler/command_line_interface_unittest.cc | 40 ++++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'src/google/protobuf/compiler/command_line_interface_unittest.cc') diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index eab14f60..366e623f 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -32,9 +32,9 @@ // Based on original Protocol Buffers design by // Sanjay Ghemawat, Jeff Dean, and others. -#include -#include #include +#include +#include #ifdef _MSC_VER #include #else @@ -46,25 +46,25 @@ #endif #include -#include -#include -#include -#include -#include +#include +#include #include #include #include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +#include namespace google { namespace protobuf { @@ -101,7 +101,7 @@ class CommandLineInterfaceTest : public testing::Test { // command is automatically split on spaces, and the string "$tmpdir" // is replaced with TestTempDir(). void Run(const string& command); - void RunWithArgs(vector args); + void RunWithArgs(std::vector args); // ----------------------------------------------------------------- // Methods to set up the test (called before Run()). @@ -301,7 +301,7 @@ void CommandLineInterfaceTest::Run(const string& command) { RunWithArgs(Split(command, " ", true)); } -void CommandLineInterfaceTest::RunWithArgs(vector args) { +void CommandLineInterfaceTest::RunWithArgs(std::vector args) { if (!disallow_plugins_) { cli_.AllowPlugins("prefix-"); #ifndef GOOGLE_THIRD_PARTY_PROTOBUF @@ -1044,7 +1044,7 @@ TEST_F(CommandLineInterfaceTest, DirectDependencies_CustomErrorMessage) { "syntax = \"proto2\";\n" "message Bar { optional string text = 1; }"); - vector commands; + std::vector commands; commands.push_back("protocol_compiler"); commands.push_back("--test_out=$tmpdir"); commands.push_back("--proto_path=$tmpdir"); @@ -1127,15 +1127,17 @@ TEST_F(CommandLineInterfaceTest, WriteDescriptorSetWithDuplicates) { ReadDescriptorSet("descriptor_set", &descriptor_set); if (HasFatalFailure()) return; EXPECT_EQ(3, descriptor_set.file_size()); - EXPECT_EQ("bar.proto", descriptor_set.file(0).name()); - EXPECT_EQ("foo.proto", descriptor_set.file(1).name()); + // foo should come first since the output is in dependency order. + // since bar and baz are unordered, they should be in command line order. + EXPECT_EQ("foo.proto", descriptor_set.file(0).name()); + EXPECT_EQ("bar.proto", descriptor_set.file(1).name()); EXPECT_EQ("baz.proto", descriptor_set.file(2).name()); // Descriptor set should not have source code info. EXPECT_FALSE(descriptor_set.file(0).has_source_code_info()); // Descriptor set should have json_name. - EXPECT_EQ("Bar", descriptor_set.file(0).message_type(0).name()); - EXPECT_EQ("foo", descriptor_set.file(0).message_type(0).field(0).name()); - EXPECT_TRUE(descriptor_set.file(0).message_type(0).field(0).has_json_name()); + EXPECT_EQ("Bar", descriptor_set.file(1).message_type(0).name()); + EXPECT_EQ("foo", descriptor_set.file(1).message_type(0).field(0).name()); + EXPECT_TRUE(descriptor_set.file(1).message_type(0).field(0).has_json_name()); } TEST_F(CommandLineInterfaceTest, WriteDescriptorSetWithSourceInfo) { -- cgit v1.2.3