aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2017-10-23 18:16:44 +0200
committerGravatar Dmitry Lomov <dslomov@google.com>2017-10-23 18:42:42 +0200
commit0a82e703427bad76884396c171a4517e88474d69 (patch)
tree5a5a4c87dcbf6426dd0ee620f07405500b4e831d /src/test/java/com/google
parentb80c21a3eee246a1e9c7b9b2b1e19f769f93430a (diff)
Change FileSystem#getDirectoryEntries to return strings of the file/directory names instead of paths.
This is a small isolated change that can be done ahead of the big refactoring. PiperOrigin-RevId: 173124518
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java3
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/UnionFileSystemTest.java14
2 files changed, 8 insertions, 9 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
index d62bc66406..4720a6e773 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
@@ -224,7 +224,8 @@ public abstract class SymlinkAwareFileSystemTest extends FileSystemTest {
// The path may not be a symlink, neither on Darwin nor on Linux.
String nonLinkEntry = null;
- for (Path p : testFS.getDirectoryEntries(rootPath)) {
+ for (String child : testFS.getDirectoryEntries(rootPath)) {
+ Path p = rootPath.getChild(child);
if (!p.isSymbolicLink() && p.isDirectory()) {
nonLinkEntry = p.getBaseName();
break;
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/UnionFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/UnionFileSystemTest.java
index df83153904..69305fa757 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/UnionFileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/UnionFileSystemTest.java
@@ -18,7 +18,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.fail;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.clock.BlazeClock;
import com.google.devtools.build.lib.clock.Clock;
import com.google.devtools.build.lib.unix.UnixFileSystem;
@@ -165,8 +164,12 @@ public class UnionFileSystemTest extends SymlinkAwareFileSystemTest {
// FileSystemTest.setUp() silently creates the test root on the filesystem...
Path testDirUnderRoot = unionfs.getPath(workingDir.asFragment().subFragment(0, 1));
assertThat(unionfs.getDirectoryEntries(unionfs.getRootDirectory()))
- .containsExactly(foo, bar, out, testDirUnderRoot);
- assertThat(unionfs.getDirectoryEntries(out)).containsExactly(outFile);
+ .containsExactly(
+ foo.getBaseName(),
+ bar.getBaseName(),
+ out.getBaseName(),
+ testDirUnderRoot.getBaseName());
+ assertThat(unionfs.getDirectoryEntries(out)).containsExactly(outFile.getBaseName());
assertThat(defaultDelegate).isSameAs(unionfs.getDelegate(foo));
assertThat(unionfs.adjustPath(foo, defaultDelegate).asFragment()).isEqualTo(foo.asFragment());
@@ -229,11 +232,6 @@ public class UnionFileSystemTest extends SymlinkAwareFileSystemTest {
unionfs.createDirectory(unionfs.getPath("/out"));
unionfs.createDirectory(unionfs.getPath("/out/foo"));
unionfs.createDirectory(unionfs.getPath("/out/foo/bar"));
- assertThat(
- Iterables.getOnlyElement(unionfs.getDirectoryEntries(unionfs.getPath("/out/foo")))
- .getParentDirectory()
- .getFileSystem())
- .isSameAs(unionfs);
}
// Write using the VFS through a UnionFileSystem and check that the file can