Search in sources :

Example 21 with RichString

use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.

the class InitialIndentationTest method assertInitialIndentation.

public void assertInitialIndentation(String expectedIndentation, String richString, String initial) throws Exception {
    RichString parsedString = richString(richString);
    InitialTemplateIndentationComputer computer = new InitialTemplateIndentationComputer(initial);
    String actualIndentation = computer.doSwitch(parsedString);
    assertEquals(richString, expectedIndentation, actualIndentation);
}
Also used : RichString(org.eclipse.xtend.core.xtend.RichString) InitialTemplateIndentationComputer(org.eclipse.xtend.core.richstring.InitialTemplateIndentationComputer) RichString(org.eclipse.xtend.core.xtend.RichString)

Example 22 with RichString

use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.

the class RichStringEvaluationTest method assertOutput.

@Override
public void assertOutput(String expectedOutput, String richString) throws Exception {
    RichString parsedString = richString(richString);
    StringBuilderBasedAcceptor acceptor = new StringBuilderBasedAcceptor();
    DefaultIndentationHandler handler = new DefaultIndentationHandler();
    RichStringProcessor processor = new RichStringProcessor();
    processor.process(parsedString, acceptor, handler);
    String actualOutput = acceptor.toString();
    assertEquals(richString, expectedOutput, actualOutput);
}
Also used : DefaultIndentationHandler(org.eclipse.xtend.core.richstring.DefaultIndentationHandler) RichStringProcessor(org.eclipse.xtend.core.richstring.RichStringProcessor) RichString(org.eclipse.xtend.core.xtend.RichString) RichString(org.eclipse.xtend.core.xtend.RichString)

Example 23 with RichString

use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.

the class RichStringProcessorTest method doTestStackIsConsistentWithErroneousModel.

protected void doTestStackIsConsistentWithErroneousModel(String string) throws Exception {
    RichString richString = richStringWithError(string);
    doCheckStackIsConsistent(richString);
}
Also used : RichString(org.eclipse.xtend.core.xtend.RichString)

Example 24 with RichString

use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.

the class RichStringProcessorTest method recordRichStringProcessorEvents.

protected String recordRichStringProcessorEvents(String string) throws Exception {
    RichString richString = richString(string);
    RichStringProcessor processor = new RichStringProcessor();
    RecordingRichStringPartAcceptor acceptor = new RecordingRichStringPartAcceptor();
    processor.process(richString, acceptor, new DefaultIndentationHandler());
    return acceptor.toString();
}
Also used : DefaultIndentationHandler(org.eclipse.xtend.core.richstring.DefaultIndentationHandler) RichStringProcessor(org.eclipse.xtend.core.richstring.RichStringProcessor) RichString(org.eclipse.xtend.core.xtend.RichString)

Example 25 with RichString

use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.

the class RichStringValidationTest method testRichStringValidation_05.

@Test
public void testRichStringValidation_05() throws Exception {
    String input = "'''    \n" + "\t\tindentedLine\n" + "\t\tindentedLine\n" + "  last line'''";
    RichString richString = richString(input);
    validationTestHelper.assertWarning(richString, XtendPackage.Literals.RICH_STRING_LITERAL, IssueCodes.INCONSISTENT_INDENTATION, "inconsistent", "indentation");
}
Also used : RichString(org.eclipse.xtend.core.xtend.RichString) RichString(org.eclipse.xtend.core.xtend.RichString) AbstractRichStringTest(org.eclipse.xtend.core.tests.richstring.AbstractRichStringTest) Test(org.junit.Test)

Aggregations

RichString (org.eclipse.xtend.core.xtend.RichString)38 Test (org.junit.Test)18 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)15 RichStringLiteral (org.eclipse.xtend.core.xtend.RichStringLiteral)11 XExpression (org.eclipse.xtext.xbase.XExpression)11 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)8 XtendField (org.eclipse.xtend.core.xtend.XtendField)6 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)6 XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)5 XBinaryOperation (org.eclipse.xtext.xbase.XBinaryOperation)4 DefaultIndentationHandler (org.eclipse.xtend.core.richstring.DefaultIndentationHandler)3 RichStringForLoop (org.eclipse.xtend.core.xtend.RichStringForLoop)3 XBooleanLiteral (org.eclipse.xtext.xbase.XBooleanLiteral)3 XStringLiteral (org.eclipse.xtext.xbase.XStringLiteral)3 EObject (org.eclipse.emf.ecore.EObject)2 RichStringProcessor (org.eclipse.xtend.core.richstring.RichStringProcessor)2 AbstractRichStringTest (org.eclipse.xtend.core.tests.richstring.AbstractRichStringTest)2 RichStringIf (org.eclipse.xtend.core.xtend.RichStringIf)2 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)2 XtendInterface (org.eclipse.xtend.core.xtend.XtendInterface)2