diff options
Diffstat (limited to 'src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java')
-rw-r--r-- | src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java b/src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java new file mode 100644 index 0000000..d867fb8 --- /dev/null +++ b/src/test/java/com/jogamp/gluegen/jcpp/JavaFileSystemTest.java @@ -0,0 +1,39 @@ +package com.jogamp.gluegen.jcpp; + +import java.io.FileNotFoundException; +import org.junit.Test; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class JavaFileSystemTest { + + @Test + public void testJavaFileSystem() throws Exception { + JavaFileSystem fs = new JavaFileSystem(); + VirtualFile f; + + /* Anyone who has this file on their Unix box is messed up. */ + f = fs.getFile("/foo/bar baz"); + try { + f.getSource(); /* drop on floor */ + + assertTrue("Got a source for a non-file", f.isFile()); + } catch (FileNotFoundException e) { + assertFalse("Got no source for a file", f.isFile()); + } + + /* We hope we have this. */ + f = fs.getFile("/usr/include/stdio.h"); + try { + f.getSource(); /* drop on floor */ + + System.out.println("Opened stdio.h"); + assertTrue("Got a source for a non-file", f.isFile()); + } catch (FileNotFoundException e) { + System.out.println("Failed to open stdio.h"); + assertFalse("Got no source for a file", f.isFile()); + } + + } + +} |