aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2017-03-07 17:15:25 +0000
committerGravatar Vladimir Moskva <vladmos@google.com>2017-03-08 10:48:38 +0000
commit4e564846a79dfeed1215d7bd72b842948093b754 (patch)
treeb70744532eedc3e9711a78efab6d23d99a739ab2
parentd72bc57b60b26245e64f5ccafe023a5ede81cc7f (diff)
Fix buildtools test on Windows
It looks like Windows PathFragments are all converted to lower-case. -- PiperOrigin-RevId: 149425977 MOS_MIGRATED_REVID=149425977
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildtool/SymlinkForestTest.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkForestTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkForestTest.java
index d86d2be261..3c93edcb42 100644
--- a/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkForestTest.java
+++ b/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkForestTest.java
@@ -101,25 +101,26 @@ public class SymlinkForestTest {
FileSystemUtils.createEmptyFile(file5);
}
- private static String longestPathPrefixStr(String path, String... prefixStrs) {
+ private static PathFragment longestPathPrefix(String path, String... prefixStrs) {
ImmutableSet.Builder<PackageIdentifier> prefixes = ImmutableSet.builder();
for (String prefix : prefixStrs) {
prefixes.add(PackageIdentifier.createInMainRepo(prefix));
}
PackageIdentifier longest = SymlinkForest.longestPathPrefix(
PackageIdentifier.createInMainRepo(path), prefixes.build());
- return longest != null ? longest.getPackageFragment().getPathString() : null;
+ return longest != null ? longest.getPackageFragment() : null;
}
@Test
public void testLongestPathPrefix() {
- assertEquals("A", longestPathPrefixStr("A/b", "A", "B")); // simple parent
- assertEquals("A", longestPathPrefixStr("A", "A", "B")); // self
- assertEquals("A/B", longestPathPrefixStr("A/B/c", "A", "A/B")); // want longest
- assertNull(longestPathPrefixStr("C/b", "A", "B")); // not found in other parents
- assertNull(longestPathPrefixStr("A", "A/B", "B")); // not found in child
- assertEquals("A/B/C", longestPathPrefixStr("A/B/C/d/e/f.h", "A/B/C", "B/C/d"));
- assertEquals("", longestPathPrefixStr("A/f.h", "", "B/C/d"));
+ PathFragment a = new PathFragment("A");
+ assertEquals(a, longestPathPrefix("A/b", "A", "B")); // simple parent
+ assertEquals(a, longestPathPrefix("A", "A", "B")); // self
+ assertEquals(a.getRelative("B"), longestPathPrefix("A/B/c", "A", "A/B")); // want longest
+ assertNull(longestPathPrefix("C/b", "A", "B")); // not found in other parents
+ assertNull(longestPathPrefix("A", "A/B", "B")); // not found in child
+ assertEquals(a.getRelative("B/C"), longestPathPrefix("A/B/C/d/e/f.h", "A/B/C", "B/C/d"));
+ assertEquals(PathFragment.EMPTY_FRAGMENT, longestPathPrefix("A/f.h", "", "B/C/d"));
}
@Test