Search in sources :

Example 26 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class MutableAssert method assertValidQualifiedName.

public static void assertValidQualifiedName(final String name, final String expectedQualifiedName, final Procedure1<? super String> codeToTest) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append(name);
    _builder.append(" has to be a valid qualified name");
    final String message = _builder.toString();
    final Procedure0 _function = () -> {
        codeToTest.apply(null);
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, message, _function);
    final Procedure0 _function_1 = () -> {
        codeToTest.apply("  ");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, message, _function_1);
    final Procedure0 _function_2 = () -> {
        codeToTest.apply("456");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, message, _function_2);
    final Procedure0 _function_3 = () -> {
        codeToTest.apply("foo. Bar ");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, message, _function_3);
    final Procedure0 _function_4 = () -> {
        codeToTest.apply("foo.456.Bar");
    };
    MutableAssert.<IllegalArgumentException>assertThrowable(IllegalArgumentException.class, message, _function_4);
    codeToTest.apply(expectedQualifiedName);
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 27 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method createPrimaryAndSecondaryType2.

@Test
public void createPrimaryAndSecondaryType2() {
    final Procedure0 _function = () -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package mypackage;");
        _builder.newLine();
        _builder.newLine();
        _builder.append("public class Bar {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("class Foo {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        this.create("/mypackage/Bar.java", _builder.toString());
    };
    this.assertThereAreDeltas(_function, "mypackage.Foo", "mypackage.Bar");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Example 28 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method deletePrimaryAndNestedTypes.

@Test
public void deletePrimaryAndNestedTypes() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("public class Bar {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public class Foo {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("public class Foo3 {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("public static class Foo2 {}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this.create("Bar.java", _builder.toString());
    final Procedure0 _function = () -> {
        this.delete("Bar.java");
    };
    this.assertThereAreDeltas(_function, "Bar", "Bar$Foo2", "Bar$Foo", "Bar$Foo$Foo3");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Example 29 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method createPrimaryAndNestedTypes2.

@Test
public void createPrimaryAndNestedTypes2() {
    final Procedure0 _function = () -> {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package mypackage;");
        _builder.newLine();
        _builder.newLine();
        _builder.append("public class Bar {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("public class Foo {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("public class Foo3 {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("public static class Foo2 {}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        this.create("/mypackage/Bar.java", _builder.toString());
    };
    this.assertThereAreDeltas(_function, "mypackage.Bar$Foo$Foo3", "mypackage.Bar$Foo", "mypackage.Bar$Foo2", "mypackage.Bar");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Example 30 with Procedure0

use of org.eclipse.xtext.xbase.lib.Procedures.Procedure0 in project xtext-xtend by eclipse.

the class TypesChangingQueuedBuildDataTest method deletePrimaryAndSecondaryType2.

@Test
public void deletePrimaryAndSecondaryType2() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package mypackage;");
    _builder.newLine();
    _builder.newLine();
    _builder.append("public class Bar {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this.create("/mypackage/Bar.java", _builder.toString());
    final Procedure0 _function = () -> {
        this.delete("/mypackage/Bar.java");
    };
    this.assertThereAreDeltas(_function, "mypackage.Bar", "mypackage.Foo");
}
Also used : Procedure0(org.eclipse.xtext.xbase.lib.Procedures.Procedure0) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractQueuedBuildDataTest(org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest) Test(org.junit.Test)

Aggregations

Procedure0 (org.eclipse.xtext.xbase.lib.Procedures.Procedure0)102 Test (org.junit.Test)79 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)53 AbstractQueuedBuildDataTest (org.eclipse.xtend.ide.tests.builder.AbstractQueuedBuildDataTest)50 AbstractBuilderParticipantTest (org.eclipse.xtext.builder.impl.AbstractBuilderParticipantTest)13 OutputConfiguration (org.eclipse.xtext.generator.OutputConfiguration)13 BadLocationException (org.eclipse.jface.text.BadLocationException)11 IFile (org.eclipse.core.resources.IFile)6 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)6 LocalArgumentsVariable (org.eclipse.n4js.n4JS.LocalArgumentsVariable)5 ITextEditor (org.eclipse.ui.texteditor.ITextEditor)5 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)5 List (java.util.List)4 TypeReference (org.eclipse.xtend.lib.macro.declaration.TypeReference)4 File (java.io.File)3 IResourceDescription (org.eclipse.xtext.resource.IResourceDescription)3 Matcher (java.util.regex.Matcher)2 JavaModelException (org.eclipse.jdt.core.JavaModelException)2 MutableFieldDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableFieldDeclaration)2 MutableInterfaceDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableInterfaceDeclaration)2