diff options
author | Shevek <[email protected]> | 2008-06-06 20:36:12 +0000 |
---|---|---|
committer | Shevek <[email protected]> | 2008-06-06 20:36:12 +0000 |
commit | 8e947d8355d4d7199505eb4c7fa88c46bc8c99a7 (patch) | |
tree | f79943ce9dc33f7e3d8cbbd179c11fe597a9c5af /src/tests/org/anarres/cpp/JavaFileSystemTestCase.java | |
parent | 8ffeabfd101d4895cf6d046dd2868c359ce042ae (diff) |
test vfs a bit
Diffstat (limited to 'src/tests/org/anarres/cpp/JavaFileSystemTestCase.java')
-rw-r--r-- | src/tests/org/anarres/cpp/JavaFileSystemTestCase.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/tests/org/anarres/cpp/JavaFileSystemTestCase.java b/src/tests/org/anarres/cpp/JavaFileSystemTestCase.java new file mode 100644 index 0000000..4f68d68 --- /dev/null +++ b/src/tests/org/anarres/cpp/JavaFileSystemTestCase.java @@ -0,0 +1,39 @@ +package org.anarres.cpp; + +import java.io.*; + +import junit.framework.Test; + +import static org.anarres.cpp.Token.*; + +public class JavaFileSystemTestCase extends BaseTestCase { + + 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()); + } + + } + +} |