use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testGetProjectChildren.
@Test
public void testGetProjectChildren() {
final Path projectFolder = new Path("/foo");
Assert.assertTrue(this.fs.exists(projectFolder));
int _size = IterableExtensions.size(this.fs.getChildren(projectFolder));
final int expectedChildrenSize = (_size + 1);
Path _path = new Path("/foo/Foo.text");
this.fs.setContents(_path, "Hello Foo");
Iterable<? extends Path> _children = this.fs.getChildren(projectFolder);
String _plus = ("" + _children);
Assert.assertEquals(_plus, expectedChildrenSize, IterableExtensions.size(this.fs.getChildren(projectFolder)));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testMakeAndDeleteFolder.
@Test
public void testMakeAndDeleteFolder() {
final Path someFolder = new Path("/foo/bar");
final Path someFile = someFolder.append("Foo.txt");
Assert.assertFalse(this.fs.exists(someFolder));
Assert.assertFalse(this.fs.isFile(someFolder));
Assert.assertFalse(this.fs.isFolder(someFolder));
this.fs.setContents(someFile, "Hello Foo");
Assert.assertFalse(this.fs.isFile(someFolder));
Assert.assertTrue(this.fs.isFolder(someFolder));
Assert.assertTrue(this.fs.exists(someFolder));
this.fs.delete(someFolder);
Assert.assertTrue(this.fs.exists(someFolder));
this.fs.delete(someFile);
this.fs.delete(someFolder);
Assert.assertFalse(this.fs.exists(someFolder));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testGetFolderChildren.
@Test
public void testGetFolderChildren() {
final Path folder = new Path("/foo/bar");
Assert.assertFalse(this.fs.exists(folder));
Path _append = folder.append("Bar.txt");
this.fs.setContents(_append, "Hello Bar");
Assert.assertTrue(this.fs.exists(folder));
Assert.assertEquals(1, IterableExtensions.size(this.fs.getChildren(folder)));
Path _path = new Path("/foo/bar/Foo.text");
this.fs.setContents(_path, "Hello Foo");
Assert.assertEquals(2, IterableExtensions.size(this.fs.getChildren(folder)));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testGetWorkspaceURI.
@Test
public void testGetWorkspaceURI() {
final Path path = Path.ROOT;
Assert.assertTrue(this.fs.exists(path));
Assert.assertNull(this.fs.toURI(path));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testModificationStamp_01.
@Test
public void testModificationStamp_01() {
try {
final Path path = new Path("/foo/src/my/pack/Foo.txt");
Assert.assertEquals(0L, this.fs.getLastModification(path));
this.fs.setContents(path, "Hello Foo");
final long mod = this.fs.getLastModification(path);
Assert.assertEquals("Hello Foo", this.fs.getContents(path));
Assert.assertEquals(mod, this.fs.getLastModification(path));
Thread.sleep(1000);
this.fs.setContents(path, "Hello Foo");
Assert.assertEquals(mod, this.fs.getLastModification(path));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations