use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class ParserTest method testRichStringFOR_01.
@Test
public void testRichStringFOR_01() throws Exception {
XtendFunction function = function("def withForLoop() '''�FOR i: 1..10��i��ENDFOR�'''");
final RichString richString = (RichString) function.getExpression();
final RichStringForLoop rsFor = (RichStringForLoop) richString.getExpressions().get(1);
assertTrue(rsFor.getForExpression() instanceof XBinaryOperation);
assertEquals("i", rsFor.getDeclaredParam().getName());
RichString eachRichString = (RichString) rsFor.getEachExpression();
assertEquals(3, eachRichString.getExpressions().size());
XExpression variableReference = eachRichString.getExpressions().get(1);
assertTrue(variableReference instanceof XFeatureCall);
assertSame(rsFor.getDeclaredParam(), ((XAbstractFeatureCall) variableReference).getFeature());
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class ParserTest method testRichStringFOR_02.
@Test
public void testRichStringFOR_02() throws Exception {
XtendFunction function = function("def withForLoop() '''�FOR i: 1..10 BEFORE 'a' SEPARATOR '\t' AFTER i��ENDFOR�'''");
final RichString richString = (RichString) function.getExpression();
final RichStringForLoop rsFor = (RichStringForLoop) richString.getExpressions().get(1);
assertTrue(rsFor.getForExpression() instanceof XBinaryOperation);
assertEquals("i", rsFor.getDeclaredParam().getName());
assertTrue(rsFor.getSeparator() instanceof XStringLiteral);
assertTrue(rsFor.getBefore() instanceof XStringLiteral);
assertTrue(rsFor.getAfter() instanceof XFeatureCall);
assertTrue(((XAbstractFeatureCall) rsFor.getAfter()).getFeature().eIsProxy());
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class ParserTest method testRichStringWithComment_03.
@Test
public void testRichStringWithComment_03() throws Exception {
XtendFunction function = function("def foo() '''first��� comment \nsecond� /* ml comment */ �third'''");
assertTrue(function.getExpression() instanceof RichString);
RichString richString = (RichString) function.getExpression();
assertEquals(3, richString.getExpressions().size());
RichStringLiteral first = (RichStringLiteral) richString.getExpressions().get(0);
assertEquals("first", first.getValue());
RichStringLiteral second = (RichStringLiteral) richString.getExpressions().get(1);
assertEquals("second", second.getValue());
RichStringLiteral third = (RichStringLiteral) richString.getExpressions().get(2);
assertEquals("third", third.getValue());
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class RichStringEvaluationTest method richString.
protected RichString richString(String string) throws Exception {
XtendClass clazz = clazz("class Foo { def foo() " + string + "}");
XtendFunction function = (XtendFunction) clazz.getMembers().get(0);
return (RichString) function.getExpression();
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class RichStringProcessorTest method doTestStackIsConsistent.
protected void doTestStackIsConsistent(String string) throws Exception {
RichString richString = richString(string);
doCheckStackIsConsistent(richString);
}
Aggregations