Search in sources :

Example 6 with Path

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));
}
Also used : Path(org.eclipse.xtend.lib.macro.file.Path) Test(org.junit.Test)

Example 7 with Path

use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.

the class JavaIoFileSystemTest method testGetFileChildren.

@Test
public void testGetFileChildren() {
    final Path file = new Path("/foo/bar/Foo.text");
    Assert.assertFalse(this.fs.exists(file));
    Assert.assertEquals(0, IterableExtensions.size(this.fs.getChildren(file)));
    this.fs.setContents(file, "Hello Foo");
    Assert.assertTrue(this.fs.exists(file));
    Assert.assertEquals(0, IterableExtensions.size(this.fs.getChildren(file)));
}
Also used : Path(org.eclipse.xtend.lib.macro.file.Path) Test(org.junit.Test)

Example 8 with Path

use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.

the class JavaIoFileSystemTest method testGetFolderURI.

@Test
public void testGetFolderURI() {
    final Path path = new Path("/foo/bar");
    Assert.assertFalse(this.fs.exists(path));
    Assert.assertNotNull(this.fs.toURI(path));
    Path _append = path.append("Foo.txt");
    this.fs.setContents(_append, "Hello Foo");
    Assert.assertTrue(this.fs.exists(path));
    Assert.assertNotNull(this.fs.toURI(path));
}
Also used : Path(org.eclipse.xtend.lib.macro.file.Path) Test(org.junit.Test)

Example 9 with Path

use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.

the class JavaIoFileSystemTest method testGetFileURI.

@Test
public void testGetFileURI() {
    final Path file = new Path("/foo/bar/Foo.text");
    Assert.assertFalse(this.fs.exists(file));
    Assert.assertNotNull(this.fs.toURI(file));
    this.fs.setContents(file, "Hello Foo");
    Assert.assertTrue(this.fs.exists(file));
    this.assertToURI(file, "Hello Foo");
}
Also used : Path(org.eclipse.xtend.lib.macro.file.Path) Test(org.junit.Test)

Example 10 with Path

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));
}
Also used : Path(org.eclipse.xtend.lib.macro.file.Path) Test(org.junit.Test)

Aggregations

Path (org.eclipse.xtend.lib.macro.file.Path)42 Test (org.junit.Test)31 File (java.io.File)3 URI (java.net.URI)2 IProject (org.eclipse.core.resources.IProject)2 URI (org.eclipse.emf.common.util.URI)2 JavaIoFileSystemTest (org.eclipse.xtend.ide.tests.macros.JavaIoFileSystemTest)2 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)2 List (java.util.List)1 IProjectDescription (org.eclipse.core.resources.IProjectDescription)1 IWorkspace (org.eclipse.core.resources.IWorkspace)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 ResourceSet (org.eclipse.emf.ecore.resource.ResourceSet)1 AbstractFileSystemSupport (org.eclipse.xtend.core.macro.AbstractFileSystemSupport)1 ChangeListenerAddingFileSystemSupport (org.eclipse.xtend.core.macro.declaration.ChangeListenerAddingFileSystemSupport)1 UIResourceChangeRegistry (org.eclipse.xtend.ide.builder.UIResourceChangeRegistry)1 MutableFieldDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration)1 OutputConfiguration (org.eclipse.xtext.generator.OutputConfiguration)1 Before (org.junit.Before)1