Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1420)

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc
diff --git a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc
index b2ec84261cadd3e353126a23fb6d3756bc1e373e..9b504d25247686de14c1feebb16b77989a9fbea0 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -57,7 +57,6 @@
#include <google/protobuf/io/printer.h>
#include <google/protobuf/unittest.pb.h>
#include <google/protobuf/testing/file.h>
-#include <google/protobuf/stubs/stringprintf.h>
#include <google/protobuf/stubs/strutil.h>
#include <google/protobuf/stubs/substitute.h>
@@ -218,7 +217,7 @@ class CommandLineInterfaceTest : public testing::Test {
string captured_stdout_;
// Pointers which need to be deleted later.
- std::vector<CodeGenerator*> mock_generators_to_delete_;
+ vector<CodeGenerator*> mock_generators_to_delete_;
NullCodeGenerator* null_generator_;
};
@@ -292,7 +291,7 @@ void CommandLineInterfaceTest::TearDown() {
}
void CommandLineInterfaceTest::Run(const string& command) {
- std::vector<string> args = Split(command, " ", true);
+ vector<string> args = Split(command, " ", true);
if (!disallow_plugins_) {
cli_.AllowPlugins("prefix-");
@@ -654,44 +653,6 @@ TEST_F(CommandLineInterfaceTest, ExtraGeneratorParameters) {
"test_generator", "baz,foo1,foo2,foo3", "foo.proto", "Foo", "b");
}
-TEST_F(CommandLineInterfaceTest, ExtraPluginParameters) {
- // Test that generator parameters specified with the option flag are
- // correctly passed to the code generator.
-
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "message Foo {}\n");
- // Create the "a" and "b" sub-directories.
- CreateTempDir("a");
- CreateTempDir("b");
-
- Run("protocol_compiler "
- "--plug_opt=foo1 "
- "--plug_out=bar:$tmpdir/a "
- "--plug_opt=foo2 "
- "--plug_out=baz:$tmpdir/b "
- "--plug_opt=foo3 "
- "--proto_path=$tmpdir foo.proto");
-
- ExpectNoErrors();
- ExpectGenerated(
- "test_plugin", "bar,foo1,foo2,foo3", "foo.proto", "Foo", "a");
- ExpectGenerated(
- "test_plugin", "baz,foo1,foo2,foo3", "foo.proto", "Foo", "b");
-}
-
-TEST_F(CommandLineInterfaceTest, UnrecognizedExtraParameters) {
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "message Foo {}\n");
-
- Run("protocol_compiler --plug_out=TestParameter:$tmpdir "
- "--unknown_plug_opt=Foo "
- "--proto_path=$tmpdir foo.proto");
-
- ExpectErrorSubstring("Unknown flag: --unknown_plug_opt");
-}
-
TEST_F(CommandLineInterfaceTest, Insert) {
// Test running a generator that inserts code into another's output.
@@ -758,11 +719,6 @@ TEST_F(CommandLineInterfaceTest, TrailingBackslash) {
ExpectGenerated("test_generator", "", "foo.proto", "Foo");
}
-TEST_F(CommandLineInterfaceTest, Win32ErrorMessage) {
- EXPECT_EQ("The system cannot find the file specified.\r\n",
- Subprocess::Win32ErrorMessage(ERROR_FILE_NOT_FOUND));
-}
-
#endif // defined(_WIN32) || defined(__CYGWIN__)
TEST_F(CommandLineInterfaceTest, PathLookup) {
@@ -830,21 +786,6 @@ TEST_F(CommandLineInterfaceTest, NonRootMapping) {
ExpectGenerated("test_generator", "", "bar/foo.proto", "Foo");
}
-TEST_F(CommandLineInterfaceTest, PathWithEqualsSign) {
- // Test setting up a search path which happens to have '=' in it.
-
- CreateTempDir("with=sign");
- CreateTempFile("with=sign/foo.proto",
- "syntax = \"proto2\";\n"
- "message Foo {}\n");
-
- Run("protocol_compiler --test_out=$tmpdir "
- "--proto_path=$tmpdir/with=sign foo.proto");
-
- ExpectNoErrors();
- ExpectGenerated("test_generator", "", "foo.proto", "Foo");
-}
-
TEST_F(CommandLineInterfaceTest, MultipleGenerators) {
// Test that we can have multiple generators and use both in one invocation,
// each with a different output directory.
@@ -910,92 +851,6 @@ TEST_F(CommandLineInterfaceTest, AllowServicesHasService) {
ExpectGenerated("test_generator", "", "foo.proto", "Foo");
}
-TEST_F(CommandLineInterfaceTest, DirectDependencies_Missing_EmptyList) {
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "import \"bar.proto\";\n"
- "message Foo { optional Bar bar = 1; }");
- CreateTempFile("bar.proto",
- "syntax = \"proto2\";\n"
- "message Bar { optional string text = 1; }");
-
- Run("protocol_compiler --test_out=$tmpdir --proto_path=$tmpdir "
- "--direct_dependencies= foo.proto");
-
- ExpectErrorText(
- "foo.proto: File is imported but not declared in --direct_dependencies: "
- "bar.proto\n");
-}
-
-TEST_F(CommandLineInterfaceTest, DirectDependencies_Missing) {
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "import \"bar.proto\";\n"
- "import \"bla.proto\";\n"
- "message Foo { optional Bar bar = 1; optional Bla bla = 2; }");
- CreateTempFile("bar.proto",
- "syntax = \"proto2\";\n"
- "message Bar { optional string text = 1; }");
- CreateTempFile("bla.proto",
- "syntax = \"proto2\";\n"
- "message Bla { optional int64 number = 1; }");
-
- Run("protocol_compiler --test_out=$tmpdir --proto_path=$tmpdir "
- "--direct_dependencies=bla.proto foo.proto");
-
- ExpectErrorText(
- "foo.proto: File is imported but not declared in --direct_dependencies: "
- "bar.proto\n");
-}
-
-TEST_F(CommandLineInterfaceTest, DirectDependencies_NoViolation) {
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "import \"bar.proto\";\n"
- "message Foo { optional Bar bar = 1; }");
- CreateTempFile("bar.proto",
- "syntax = \"proto2\";\n"
- "message Bar { optional string text = 1; }");
-
- Run("protocol_compiler --test_out=$tmpdir --proto_path=$tmpdir "
- "--direct_dependencies=bar.proto foo.proto");
-
- ExpectNoErrors();
-}
-
-TEST_F(CommandLineInterfaceTest, DirectDependencies_NoViolation_MultiImports) {
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "import \"bar.proto\";\n"
- "import \"bla.proto\";\n"
- "message Foo { optional Bar bar = 1; optional Bla bla = 2; }");
- CreateTempFile("bar.proto",
- "syntax = \"proto2\";\n"
- "message Bar { optional string text = 1; }");
- CreateTempFile("bla.proto",
- "syntax = \"proto2\";\n"
- "message Bla { optional int64 number = 1; }");
-
- Run("protocol_compiler --test_out=$tmpdir --proto_path=$tmpdir "
- "--direct_dependencies=bar.proto:bla.proto foo.proto");
-
- ExpectNoErrors();
-}
-
-TEST_F(CommandLineInterfaceTest, DirectDependencies_ProvidedMultipleTimes) {
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n");
-
- Run("protocol_compiler --test_out=$tmpdir --proto_path=$tmpdir "
- "--direct_dependencies=bar.proto --direct_dependencies=bla.proto "
- "foo.proto");
-
- ExpectErrorText(
- "--direct_dependencies may only be passed once. To specify multiple "
- "direct dependencies, pass them all as a single parameter separated by "
- "':'.\n");
-}
-
TEST_F(CommandLineInterfaceTest, CwdRelativeInputs) {
// Test that we can accept working-directory-relative input files.
@@ -1583,21 +1438,6 @@ TEST_F(CommandLineInterfaceTest, PluginReceivesJsonName) {
ExpectErrorSubstring("Saw json_name: 1");
}
-TEST_F(CommandLineInterfaceTest, PluginReceivesCompilerVersion) {
- CreateTempFile("foo.proto",
- "syntax = \"proto2\";\n"
- "message MockCodeGenerator_ShowVersionNumber {\n"
- " optional int32 value = 1;\n"
- "}\n");
-
- Run("protocol_compiler --plug_out=$tmpdir --proto_path=$tmpdir foo.proto");
-
- ExpectErrorSubstring(
- StringPrintf("Saw compiler_version: %d %s",
- GOOGLE_PROTOBUF_VERSION,
- GOOGLE_PROTOBUF_VERSION_SUFFIX));
-}
-
TEST_F(CommandLineInterfaceTest, GeneratorPluginNotFound) {
// Test what happens if the plugin isn't found.
@@ -1872,7 +1712,7 @@ class EncodeDecodeTest : public testing::Test {
enum ReturnCode { SUCCESS, ERROR };
bool Run(const string& command) {
- std::vector<string> args;
+ vector<string> args;
args.push_back("protoc");
SplitStringUsing(command, " ", &args);
args.push_back("--proto_path=" + TestSourceDir());

Powered by Google App Engine
This is Rietveld 408576698