aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java56
1 files changed, 18 insertions, 38 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
index e8896bbc0d..ba4b4e8c57 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
@@ -476,67 +476,47 @@ public abstract class FileSystemTest {
}
@Test
- public void testCreateDirectoryAndParents() throws Exception {
+ public void testCreateDirectories() throws Exception {
Path newPath = absolutize("new-dir/sub/directory");
newPath.createDirectoryAndParents();
assertThat(newPath.isDirectory()).isTrue();
}
@Test
- public void testCreateDirectoryAndParentsCreatesEmptyDirectory() throws Exception {
+ public void testCreateDirectoriesIsNotFile() throws Exception {
Path newPath = absolutize("new-dir/sub/directory");
newPath.createDirectoryAndParents();
- assertThat(newPath.getDirectoryEntries()).isEmpty();
+ assertThat(newPath.isFile()).isFalse();
}
@Test
- public void testCreateDirectoryAndParentsIsOnlyChildInParent() throws Exception {
+ public void testCreateDirectoriesIsNotSymbolicLink() throws Exception {
Path newPath = absolutize("new-dir/sub/directory");
newPath.createDirectoryAndParents();
- assertThat(newPath.getParentDirectory().getDirectoryEntries()).hasSize(1);
- assertThat(newPath.getParentDirectory().getDirectoryEntries()).containsExactly(newPath);
+ assertThat(newPath.isSymbolicLink()).isFalse();
}
@Test
- public void testCreateDirectoryAndParentsWhenAlreadyExistsSucceeds() throws Exception {
- Path newPath = absolutize("new-dir");
- newPath.createDirectory();
+ public void testCreateDirectoriesIsEmpty() throws Exception {
+ Path newPath = absolutize("new-dir/sub/directory");
newPath.createDirectoryAndParents();
- assertThat(newPath.isDirectory()).isTrue();
- }
-
- @Test
- public void testCreateDirectoryAndParentsWhenAncestorIsFile() throws IOException {
- Path path = absolutize("somewhere/deep/in");
- path.getParentDirectory().createDirectoryAndParents();
- FileSystemUtils.createEmptyFile(path);
- Path theHierarchy = path.getChild("the-hierarchy");
- MoreAsserts.assertThrows(IOException.class, theHierarchy::createDirectoryAndParents);
+ assertThat(newPath.getDirectoryEntries()).isEmpty();
}
@Test
- public void testCreateDirectoryAndParentsWhenSymlinkToDir() throws IOException {
- Path somewhereDeepIn = absolutize("somewhere/deep/in");
- somewhereDeepIn.createDirectoryAndParents();
- Path realDir = absolutize("real/dir");
- realDir.createDirectoryAndParents();
- assertThat(realDir.isDirectory()).isTrue();
- Path theHierarchy = somewhereDeepIn.getChild("the-hierarchy");
- theHierarchy.createSymbolicLink(realDir);
- assertThat(theHierarchy.isDirectory()).isTrue();
- theHierarchy.createDirectoryAndParents();
+ public void testCreateDirectoriesIsOnlyChildInParent() throws Exception {
+ Path newPath = absolutize("new-dir/sub/directory");
+ newPath.createDirectoryAndParents();
+ assertThat(newPath.getParentDirectory().getDirectoryEntries()).hasSize(1);
+ assertThat(newPath.getParentDirectory().getDirectoryEntries()).containsExactly(newPath);
}
@Test
- public void testCreateDirectoryAndParentsWhenSymlinkEmbedded() throws IOException {
- Path somewhereDeepIn = absolutize("somewhere/deep/in");
- somewhereDeepIn.createDirectoryAndParents();
- Path realDir = absolutize("real/dir");
- realDir.createDirectoryAndParents();
- Path the = somewhereDeepIn.getChild("the");
- the.createSymbolicLink(realDir);
- Path theHierarchy = somewhereDeepIn.getChild("hierarchy");
- theHierarchy.createDirectoryAndParents();
+ public void testCreateAlreadyExistingDirectorySucceeds() throws Exception {
+ Path newPath = absolutize("new-dir");
+ newPath.createDirectory();
+ newPath.createDirectoryAndParents();
+ assertThat(newPath.isDirectory()).isTrue();
}
@Test