diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-12-02 05:59:15 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-12-02 05:59:15 +0000 |
commit | 2f669cbe75c054851234b7789342a5650ef951a5 (patch) | |
tree | 942580b700e524a01ee01276af4f09c270676197 /src/google/protobuf/compiler/importer_unittest.cc | |
parent | eb241fadf22bd9cafa3c2b2e91a914a12df07993 (diff) |
* Avoid using pushd/popd in generate_descriptor_proto.sh because they are
bash-only features, and /bin/sh is not a symlink to bash on all systems.
* If an input file is a Windows absolute path (e.g. "C:\foo\bar.proto") and
the import path only contains "." (or contains "." but does not contain
the file), protoc incorrectly thought that the file was under ".", because
it thought that the path was relative (since it didn't start with a slash).
This has been fixed.
Diffstat (limited to 'src/google/protobuf/compiler/importer_unittest.cc')
-rw-r--r-- | src/google/protobuf/compiler/importer_unittest.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/importer_unittest.cc b/src/google/protobuf/compiler/importer_unittest.cc index 173a3373..51aeb90c 100644 --- a/src/google/protobuf/compiler/importer_unittest.cc +++ b/src/google/protobuf/compiler/importer_unittest.cc @@ -516,6 +516,18 @@ TEST_F(DiskSourceTreeTest, DiskFileToVirtualFileCanonicalization) { source_tree_.DiskFileToVirtualFile( "../../baz", &virtual_file, &shadowing_disk_file)); + // "/foo" is not mapped (it should not be misintepreted as being under "."). + EXPECT_EQ(DiskSourceTree::NO_MAPPING, + source_tree_.DiskFileToVirtualFile( + "/foo", &virtual_file, &shadowing_disk_file)); + +#ifdef WIN32 + // "C:\foo" is not mapped (it should not be misintepreted as being under "."). + EXPECT_EQ(DiskSourceTree::NO_MAPPING, + source_tree_.DiskFileToVirtualFile( + "C:\\foo", &virtual_file, &shadowing_disk_file)); +#endif // WIN32 + // But "../baz" should be. EXPECT_EQ(DiskSourceTree::CANNOT_OPEN, source_tree_.DiskFileToVirtualFile( |