Search in sources :

Example 76 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class PrecompiledHeaderGeneratorPrecompiledHeaderSpec method _headerFile.

/**
   * @filter('''|.isGenerated.*)
   */
@Test
@Named("Header file")
@Order(1)
public void _headerFile() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("#import <Availability.h>");
    _builder.newLine();
    _builder.newLine();
    _builder.append("#ifndef __IPHONE_3_0");
    _builder.newLine();
    _builder.append("#warning \"This project uses features only available in iOS SDK 3.0 and later.\"");
    _builder.newLine();
    _builder.append("#endif");
    _builder.newLine();
    _builder.newLine();
    _builder.append("#ifdef __OBJC__");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("#import <UIKit/UIKit.h>");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("#import <Foundation/Foundation.h>");
    _builder.newLine();
    _builder.append("#endif\t");
    _builder.newLine();
    this.isGeneratedModuleFile(_builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Order(org.jnario.runner.Order) Named(org.jnario.runner.Named) Test(org.junit.Test)

Example 77 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class EntitiesDefiningEntitiesSpec method _simpleEntities.

/**
   * Entities can be defined using the `entity` keyword.
   * @filter('''|.isValid.*)
   */
@Test
@Named("Simple entities")
@Order(1)
public void _simpleEntities() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("entity Person {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this._entitiesValidationTestHelper.isValidEntity(_builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Order(org.jnario.runner.Order) Named(org.jnario.runner.Named) Test(org.junit.Test)

Example 78 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class EntitiesDefiningEntitiesSpec method _entityInheritance.

/**
   * Entities can extend other entities.
   * @filter('''|.isValid.*)
   */
@Test
@Named("Entity inheritance")
@Order(3)
public void _entityInheritance() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("entity Person {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.append("entity Employee extends Person {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this._entitiesValidationTestHelper.isValidEntityWithInheritance(_builder);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Order(org.jnario.runner.Order) Named(org.jnario.runner.Named) Test(org.junit.Test)

Example 79 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class EntityDataMappingGeneratorMappingEntitiesDataMappingCodeSpec method _implementationFile.

/**
   * @filter('''|.isGenerated.*)
   */
@Test
@Named("Implementation file")
@Order(2)
public void _implementationFile() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("#import \"Person.h\"");
    _builder.newLine();
    _builder.append("#import \"Person+DataMapping.h\"");
    _builder.newLine();
    _builder.newLine();
    _builder.append("@implementation Person (DataMapping)");
    _builder.newLine();
    _builder.append("- (id)initWithAttributes:(NSDictionary *)attributes");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("self = [super init];");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("if (self) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("self.name = [attributes valueForKeyPath:@\"name\"];");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("return self;");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("- (NSDictionary *)attributes");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init];");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("if (self.name != nil) {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("attributes[@\"name\"] = self.name;");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("return attributes;");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.append("@end");
    _builder.newLine();
    this.isGeneratedModuleFileFromModel(_builder, "Person", this.simplePersonEntity);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Order(org.jnario.runner.Order) Named(org.jnario.runner.Named) Test(org.junit.Test)

Example 80 with StringConcatenation

use of org.eclipse.xtend2.lib.StringConcatenation in project applause by applause.

the class EntityGeneratorGeneratingEntitiesEntityInheritanceSpec method _implementationFile.

/**
   * @filter('''|.isGenerated.*)
   */
@Test
@Named("Implementation file")
@Order(2)
public void _implementationFile() throws Exception {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("#import \"Person.h\"");
    _builder.newLine();
    _builder.append("#import \"Creature.h\"");
    _builder.newLine();
    _builder.newLine();
    _builder.append("@implementation Person");
    _builder.newLine();
    _builder.append("@end");
    _builder.newLine();
    this.isGeneratedModuleFileFromModel(_builder, "Person", this.inheritedPersonEntity);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Order(org.jnario.runner.Order) Named(org.jnario.runner.Named) Test(org.junit.Test)

Aggregations

StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4966 Test (org.junit.Test)4419 AbstractXtendCompilerTest (org.eclipse.xtend.core.tests.compiler.AbstractXtendCompilerTest)1231 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)372 AbstractXtendFormatterTest (org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest)214 AbstractXtendContentAssistBugTest (org.eclipse.xtend.ide.tests.contentassist.AbstractXtendContentAssistBugTest)183 ContentAssistProcessorTestBuilder (org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder)182 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)131 CompilationUnitImpl (org.eclipse.xtend.core.macro.declaration.CompilationUnitImpl)130 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)129 IFile (org.eclipse.core.resources.IFile)122 QuickfixTestBuilder (org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder)122 AmbiguityValidationTest (org.eclipse.xtend.core.tests.validation.AmbiguityValidationTest)118 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)115 Grammar (org.eclipse.xtext.Grammar)101 EObject (org.eclipse.emf.ecore.EObject)99 MapBasedPreferenceValues (org.eclipse.xtext.preferences.MapBasedPreferenceValues)99 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)99 MutableClassDeclaration (org.eclipse.xtend.lib.macro.declaration.MutableClassDeclaration)97 AbstractRule (org.eclipse.xtext.AbstractRule)96