diff options
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/vfs/ScopeEscapableFileSystemTest.java | 1 | ||||
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/ScopeEscapableFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/ScopeEscapableFileSystemTest.java index 719ffde41c..87c4cce17a 100644 --- a/src/test/java/com/google/devtools/build/lib/vfs/ScopeEscapableFileSystemTest.java +++ b/src/test/java/com/google/devtools/build/lib/vfs/ScopeEscapableFileSystemTest.java @@ -85,6 +85,7 @@ public abstract class ScopeEscapableFileSystemTest extends SymlinkAwareFileSyste @Override protected boolean isWritable(Path path) { throw re(); } @Override protected boolean isDirectory(Path path, boolean followSymlinks) { throw re(); } @Override protected boolean isFile(Path path, boolean followSymlinks) { throw re(); } + @Override protected boolean isSpecialFile(Path path, boolean followSymlinks) { throw re(); } @Override protected boolean isExecutable(Path path) { throw re(); } @Override protected boolean exists(Path path, boolean followSymlinks) {throw re(); } @Override protected boolean isSymbolicLink(Path path) { throw re(); } diff --git a/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java index cb5685ed6b..40ace2b6f6 100644 --- a/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java +++ b/src/test/java/com/google/devtools/build/lib/vfs/UnixFileSystemTest.java @@ -15,8 +15,10 @@ package com.google.devtools.build.lib.vfs; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import com.google.devtools.build.lib.unix.FilesystemUtils; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -60,4 +62,20 @@ public class UnixFileSystemTest extends SymlinkAwareFileSystemTest { // Expected. } } + + @Test + public void testIsSpecialFile() throws Exception { + Path regular = absolutize("regular"); + Path fifo = absolutize("fifo"); + FileSystemUtils.createEmptyFile(regular); + FilesystemUtils.mkfifo(fifo.toString(), 0777); + assertTrue(regular.isFile()); + assertFalse(regular.isSpecialFile()); + assertTrue(regular.stat().isFile()); + assertFalse(regular.stat().isSpecialFile()); + assertTrue(fifo.isFile()); + assertTrue(fifo.isSpecialFile()); + assertTrue(fifo.stat().isFile()); + assertTrue(fifo.stat().isSpecialFile()); + } } |