use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testGetProjectURI.
@Test
public void testGetProjectURI() {
final Path path = new Path("/foo");
Assert.assertTrue(this.fs.exists(path));
Assert.assertNotNull(this.fs.toURI(path));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testModificationStamp_02.
@Test
public void testModificationStamp_02() {
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 Bar");
long _lastModification = this.fs.getLastModification(path);
boolean _lessThan = (mod < _lastModification);
Assert.assertTrue(_lessThan);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
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 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 PathTest method testPath.
@Test
public void testPath() {
final Path p = new Path("/foo/bar/baz.txt");
Assert.assertTrue(p.isAbsolute());
Assert.assertEquals("baz.txt", p.getLastSegment());
Assert.assertEquals("txt", p.getFileExtension());
Assert.assertEquals("foo", IterableExtensions.<String>head(p.getSegments()));
Assert.assertEquals("bar", p.getSegments().get(1));
Assert.assertEquals(3, p.getSegments().size());
Assert.assertEquals("/foo/bar/baz.txt", p.toString());
}
Aggregations