aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/command_line_interface_unittest.cc
diff options
context:
space:
mode:
authorBo Yang <paulyang1211@gmail.com>2015-02-09 11:57:41 -0800
committerBo Yang <paulyang1211@gmail.com>2015-02-09 11:57:41 -0800
commiteb2ce0293138532680fdd3647c01db7587b9367b (patch)
treebe85bbb783aeb2164de73a6a7c7a85add055e10b /src/google/protobuf/compiler/command_line_interface_unittest.cc
parente2555e235f867f3d7a0378e95a45109c8fd2dfbe (diff)
downloadprotobuf-eb2ce0293138532680fdd3647c01db7587b9367b.tar.gz
protobuf-eb2ce0293138532680fdd3647c01db7587b9367b.tar.bz2
protobuf-eb2ce0293138532680fdd3647c01db7587b9367b.zip
Fix absolute/relative path in output
Diffstat (limited to 'src/google/protobuf/compiler/command_line_interface_unittest.cc')
-rw-r--r--src/google/protobuf/compiler/command_line_interface_unittest.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc
index 9e02f729..2aba68b9 100644
--- a/src/google/protobuf/compiler/command_line_interface_unittest.cc
+++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc
@@ -988,17 +988,22 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFile) {
" optional Foo foo = 1;\n"
"}\n");
- Run("protocol_compiler --dependency_out=$tmpdir/manifest "
- "--test_out=$tmpdir --proto_path=$tmpdir bar.proto");
+ string current_working_directory = get_current_dir_name();
+ SwitchToTempDirectory();
+
+ Run("protocol_compiler --dependency_out=manifest --test_out=. "
+ "bar.proto");
ExpectNoErrors();
ExpectFileContent("manifest",
- "$tmpdir/bar.proto.MockCodeGenerator.test_generator: "
- "$tmpdir/foo.proto\\\n $tmpdir/bar.proto");
+ "bar.proto.MockCodeGenerator.test_generator: "
+ "foo.proto\\\n bar.proto");
+
+ File::ChangeWorkingDirectory(current_working_directory);
}
-TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileForRelativePath) {
+TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileForAbsolutePath) {
CreateTempFile("foo.proto",
"syntax = \"proto2\";\n"
"message Foo {}\n");
@@ -1009,10 +1014,7 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileForRelativePath) {
" optional Foo foo = 1;\n"
"}\n");
- string current_working_directory = get_current_dir_name();
- SwitchToTempDirectory();
-
- Run("protocol_compiler --dependency_out=manifest "
+ Run("protocol_compiler --dependency_out=$tmpdir/manifest "
"--test_out=$tmpdir --proto_path=$tmpdir bar.proto");
ExpectNoErrors();
@@ -1020,8 +1022,6 @@ TEST_F(CommandLineInterfaceTest, WriteDependencyManifestFileForRelativePath) {
ExpectFileContent("manifest",
"$tmpdir/bar.proto.MockCodeGenerator.test_generator: "
"$tmpdir/foo.proto\\\n $tmpdir/bar.proto");
-
- File::ChangeWorkingDirectory(current_working_directory);
}
// -------------------------------------------------------------------