aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/command_line_interface_unittest.cc
diff options
context:
space:
mode:
authorkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-18 07:20:43 +0000
committerkenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-18 07:20:43 +0000
commit91218afc67773ebf85e37d91c80cb3a7d423b0ba (patch)
treea2f5a73a5a136924ae07064f366c22deefddf4a2 /src/google/protobuf/compiler/command_line_interface_unittest.cc
parent5e744ff9612da1add0dd0f893242703246c00d0c (diff)
downloadprotobuf-91218afc67773ebf85e37d91c80cb3a7d423b0ba.tar.gz
protobuf-91218afc67773ebf85e37d91c80cb3a7d423b0ba.tar.bz2
protobuf-91218afc67773ebf85e37d91c80cb3a7d423b0ba.zip
Fix Cygwin build.
Diffstat (limited to 'src/google/protobuf/compiler/command_line_interface_unittest.cc')
-rw-r--r--src/google/protobuf/compiler/command_line_interface_unittest.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc
index 83850cf9..b43f781c 100644
--- a/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -146,6 +146,8 @@ class CommandLineInterfaceTest : public testing::Test {
const string& proto_name,
const string& message_name);
+ void ExpectNullCodeGeneratorCalled(const string& parameter);
+
void ReadDescriptorSet(const string& filename,
FileDescriptorSet* descriptor_set);
@@ -170,6 +172,8 @@ class CommandLineInterfaceTest : public testing::Test {
// Pointers which need to be deleted later.
vector<CodeGenerator*> mock_generators_to_delete_;
+
+ NullCodeGenerator* null_generator_;
};
class CommandLineInterfaceTest::NullCodeGenerator : public CodeGenerator {
@@ -220,7 +224,7 @@ void CommandLineInterfaceTest::SetUp() {
mock_generators_to_delete_.push_back(generator);
cli_.RegisterGenerator("--alt_out", generator, "Alt output.");
- generator = new NullCodeGenerator();
+ generator = null_generator_ = new NullCodeGenerator();
mock_generators_to_delete_.push_back(generator);
cli_.RegisterGenerator("--null_out", generator, "Null output.");
@@ -338,6 +342,12 @@ void CommandLineInterfaceTest::ExpectGeneratedWithInsertions(
temp_directory_);
}
+void CommandLineInterfaceTest::ExpectNullCodeGeneratorCalled(
+ const string& parameter) {
+ EXPECT_TRUE(null_generator_->called_);
+ EXPECT_EQ(parameter, null_generator_->parameter_);
+}
+
void CommandLineInterfaceTest::ReadDescriptorSet(
const string& filename, FileDescriptorSet* descriptor_set) {
string path = temp_directory_ + "/" + filename;
@@ -481,8 +491,7 @@ TEST_F(CommandLineInterfaceTest, WindowsOutputPath) {
"--proto_path=$tmpdir foo.proto");
ExpectNoErrors();
- EXPECT_TRUE(generator->called_);
- EXPECT_EQ("", generator->parameter_);
+ ExpectNullCodeGeneratorCalled("");
}
TEST_F(CommandLineInterfaceTest, WindowsOutputPathAndParameter) {
@@ -495,8 +504,7 @@ TEST_F(CommandLineInterfaceTest, WindowsOutputPathAndParameter) {
"--proto_path=$tmpdir foo.proto");
ExpectNoErrors();
- EXPECT_TRUE(generator->called_);
- EXPECT_EQ("bar", generator->parameter_);
+ ExpectNullCodeGeneratorCalled("bar");
}
TEST_F(CommandLineInterfaceTest, TrailingBackslash) {