Search in sources :

Example 41 with Path

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

the class PathTest method testRelativize.

@Test
public void testRelativize() {
    Path _path = new Path("foo");
    Assert.assertEquals(_path, new Path("/hubba/bubba/foo").relativize("/hubba/bubba"));
    Path _path_1 = new Path("foo");
    Assert.assertEquals(_path_1, new Path("hubba/bubba/foo").relativize("hubba/bubba"));
    try {
        new Path("hubba/bubba/foo").relativize("/hubba/bubba");
    } catch (final Throwable _t) {
        if (_t instanceof IllegalArgumentException) {
        } else {
            throw Exceptions.sneakyThrow(_t);
        }
    }
    try {
        new Path("/hubba/bubba/foo").relativize("hubba/bubba");
    } catch (final Throwable _t_1) {
        if (_t_1 instanceof IllegalArgumentException) {
        } else {
            throw Exceptions.sneakyThrow(_t_1);
        }
    }
    Assert.assertNull(new Path("/foo").relativize("/bar"));
}
Also used : Path(org.eclipse.xtend.lib.macro.file.Path) Test(org.junit.Test)

Example 42 with Path

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

the class PathTest method testPathStartsWith.

@Test
public void testPathStartsWith() {
    Path _path = new Path("/foo/bar/baz.txt");
    Path _path_1 = new Path("/");
    Assert.assertTrue(_path.startsWith(_path_1));
    Path _path_2 = new Path("/foo/bar/baz.txt");
    Path _path_3 = new Path("/foo");
    Assert.assertTrue(_path_2.startsWith(_path_3));
    Path _path_4 = new Path("/foo/bar/baz.txt");
    Path _path_5 = new Path("/foo/bar");
    Assert.assertTrue(_path_4.startsWith(_path_5));
    Path _path_6 = new Path("/foo/bar/baz.txt");
    Path _path_7 = new Path("/foo/bar/baz.txt");
    Assert.assertTrue(_path_6.startsWith(_path_7));
    Path _path_8 = new Path("/foo/bar/baz.txt");
    Path _path_9 = new Path("foo");
    Assert.assertFalse(_path_8.startsWith(_path_9));
    Path _path_10 = new Path("/foo/bar/baz.txt");
    Path _path_11 = new Path("foo/bar/baz.txt");
    Assert.assertFalse(_path_10.startsWith(_path_11));
    Path _path_12 = new Path("/foo/bar/baz.txt");
    Path _path_13 = new Path("/foo/bar/baz");
    Assert.assertFalse(_path_12.startsWith(_path_13));
}
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