use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class JavaConverterTest method testRichStringSpecialCase2.
@Test
public void testRichStringSpecialCase2() throws Exception {
XtendClass clazz = this.toValidXtendClass((("class Z { String richTxt = \"test\" + \"\'\'\'�FOR a: \'123\'.toCharArray SEPARATOR \',\\n \\t\'�\\n" + "a\\n") + "�ENDFOR�\'\'\'\";}"));
Assert.assertNotNull(clazz);
XtendMember _get = clazz.getMembers().get(0);
XtendField xtendMember = ((XtendField) _get);
Assert.assertEquals("richTxt", xtendMember.getName());
XExpression _initialValue = xtendMember.getInitialValue();
Assert.assertFalse((_initialValue instanceof RichString));
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class ValueConverterExceptionProducesErrorTest method assertLiteral.
private void assertLiteral(final String expectation, final Resource resource) {
EObject _head = IterableExtensions.<EObject>head(resource.getContents());
final XtendFile file = ((XtendFile) _head);
final XtendTypeDeclaration type = IterableExtensions.<XtendTypeDeclaration>head(file.getXtendTypes());
XtendMember _head_1 = IterableExtensions.<XtendMember>head(type.getMembers());
final XtendFunction method = ((XtendFunction) _head_1);
XExpression _expression = method.getExpression();
final RichString body = ((RichString) _expression);
XExpression _head_2 = IterableExtensions.<XExpression>head(body.getExpressions());
final RichStringLiteral singleElement = ((RichStringLiteral) _head_2);
Assert.assertEquals(expectation, singleElement.getValue());
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class ParserTest method testRichStringIF_00.
@Test
public void testRichStringIF_00() throws Exception {
XtendFunction function = function("def foo() ''' foo �IF true� wurst �ELSEIF null==3� brot �ELSE� machine �ENDIF� bar '''");
final RichString richString = (RichString) function.getExpression();
assertTrue(richString.getExpressions().get(0) instanceof RichStringLiteral);
final RichStringIf rsIf = (RichStringIf) richString.getExpressions().get(1);
assertTrue(rsIf.getIf() instanceof XBooleanLiteral);
assertTrue(rsIf.getThen() instanceof RichString);
assertEquals(1, rsIf.getElseIfs().size());
RichStringElseIf elseIf = rsIf.getElseIfs().get(0);
assertTrue(elseIf.getIf() instanceof XBinaryOperation);
assertTrue(elseIf.getThen() instanceof RichString);
assertTrue(rsIf.getElse() instanceof RichString);
assertTrue(richString.getExpressions().get(2) instanceof RichStringLiteral);
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class ParserTest method testRichStringWithComment_01.
@Test
public void testRichStringWithComment_01() throws Exception {
XtendFunction function = function("def foo() '''first� /* ml comment\n */ �� sl_comment \nsecond'''");
assertTrue(function.getExpression() instanceof RichString);
RichString richString = (RichString) function.getExpression();
assertEquals(2, 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());
}
use of org.eclipse.xtend.core.xtend.RichString in project xtext-xtend by eclipse.
the class ParserTest method testRichStringWithComment_00.
@Test
public void testRichStringWithComment_00() throws Exception {
XtendFunction function = function("def foo() '''first��� comment \nsecond'''");
assertTrue(function.getExpression() instanceof RichString);
RichString richString = (RichString) function.getExpression();
assertEquals(2, 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());
}
Aggregations