aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/vfs
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-04-12 16:00:51 +0000
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-04-13 09:36:42 +0200
commit8dec2cabab9f62c675c0994484101a54f79dda65 (patch)
tree47671488cae4e176e4755711cdbc5f92543d7e4e /src/test/java/com/google/devtools/build/lib/vfs
parentfc7296ff86b111d0e9c6cdc2d19b726d199a592c (diff)
Document the current confusing semantics of relative windows paths with drive letters.
RELNOTES: None PiperOrigin-RevId: 152944088
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/vfs')
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/PathFragmentWindowsTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentWindowsTest.java b/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentWindowsTest.java
index d22080901b..4915a889ff 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentWindowsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/PathFragmentWindowsTest.java
@@ -248,6 +248,31 @@ public class PathFragmentWindowsTest {
}
@Test
+ public void testConfusingSemanticsOfDriveLettersInRelativePaths() {
+ // This test serves to document the current confusing semantics of non-empty relative windows
+ // paths that have drive letters. Also note the above testEmptyRelativePathToEmptyPathWindows
+ // which documents the confusing semantics of empty relative windows paths that have drive
+ // letters.
+ //
+ // TODO(laszlocsomor): Reevaluate the current semantics. Depending on the results of that,
+ // consider not storing the drive letter in relative windows paths.
+ PathFragment cColonFoo = PathFragment.create("C:foo");
+ PathFragment dColonFoo = PathFragment.create("D:foo");
+ PathFragment foo = PathFragment.create("foo");
+ assertThat(cColonFoo).isNotEqualTo(dColonFoo);
+ assertThat(cColonFoo).isNotEqualTo(foo);
+ assertThat(dColonFoo).isNotEqualTo(foo);
+ assertThat(cColonFoo.segmentCount()).isEqualTo(dColonFoo.segmentCount());
+ assertThat(cColonFoo.segmentCount()).isEqualTo(foo.segmentCount());
+ assertThat(cColonFoo.startsWith(dColonFoo)).isTrue();
+ assertThat(cColonFoo.startsWith(foo)).isTrue();
+ assertThat(foo.startsWith(cColonFoo)).isTrue();
+ assertThat(cColonFoo.getPathString()).isEqualTo("foo");
+ assertThat(cColonFoo.getPathString()).isEqualTo(dColonFoo.getPathString());
+ assertThat(cColonFoo.getPathString()).isEqualTo(foo.getPathString());
+ }
+
+ @Test
public void testWindowsVolumeUppercase() {
assertRegular("C:/", "c:/");
}