use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class UnicodeEscapeLinkingTest method testIdentifiersWithUnicode_02.
@Test
public void testIdentifiersWithUnicode_02() throws Exception {
XtendClass clazz = clazz("class A {\n" + " String \\u0061\n" + " def m() {\n" + " a\n" + " }\n" + "}");
XFeatureCall call = (XFeatureCall) ((XBlockExpression) ((XtendFunction) clazz.getMembers().get(1)).getExpression()).getExpressions().get(0);
JvmIdentifiableElement feature = call.getFeature();
assertFalse(feature.eIsProxy());
assertSame(feature, associator.getJvmField((XtendField) clazz.getMembers().get(0)));
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class ParserTest method testXtendField_03.
@Test
public void testXtendField_03() throws Exception {
XtendClass clazz = clazz("class Foo { " + " @com.google.inject.Inject java.util.Map<String,String> map" + " @com.google.inject.Inject java.util.List myList" + "}");
assertEquals(2, clazz.getMembers().size());
XtendField field = (XtendField) clazz.getMembers().get(0);
assertEquals("java.util.Map", field.getType().getType().getIdentifier());
assertEquals("map", field.getName());
assertEquals("java.util.Map<java.lang.String, java.lang.String>", field.getType().getIdentifier());
field = (XtendField) clazz.getMembers().get(1);
assertEquals("java.util.List", field.getType().getType().getIdentifier());
assertEquals("myList", field.getName());
assertEquals("java.util.List", field.getType().getIdentifier());
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class ParserTest method testXtendField_00.
@Test
public void testXtendField_00() throws Exception {
XtendClass clazz = clazz("class Foo { " + " @com.google.inject.Inject java.util.Map<String,String> map" + "}");
assertEquals(1, clazz.getMembers().size());
XtendField field = (XtendField) clazz.getMembers().get(0);
assertEquals("java.util.Map", field.getType().getType().getIdentifier());
assertEquals("map", field.getName());
assertEquals("java.util.Map<java.lang.String, java.lang.String>", field.getType().getIdentifier());
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class ParserTest method testXtendField_01.
@Test
public void testXtendField_01() throws Exception {
XtendClass clazz = clazz("class Foo { " + " @com.google.inject.Inject java.util.Map<String,String> map def map() {null as String}" + "}");
assertEquals(2, clazz.getMembers().size());
XtendField field = (XtendField) clazz.getMembers().get(0);
assertEquals("java.util.Map", field.getType().getType().getIdentifier());
assertEquals("map", field.getName());
assertEquals("java.util.Map<java.lang.String, java.lang.String>", field.getType().getIdentifier());
assertTrue(clazz.getMembers().get(1) instanceof XtendFunction);
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class ParserTest method testXtendField_04.
@Test
public void testXtendField_04() throws Exception {
XtendClass clazz = clazz("class Foo { " + " @com.google.inject.Inject val foo = 'foo'" + " @com.google.inject.Inject var java.util.List myList" + "}");
assertEquals(2, clazz.getMembers().size());
XtendField field = (XtendField) clazz.getMembers().get(0);
assertNull(field.getType());
assertEquals("foo", field.getName());
assertTrue(field.getInitialValue() instanceof XStringLiteral);
field = (XtendField) clazz.getMembers().get(1);
assertEquals("java.util.List", field.getType().getType().getIdentifier());
assertEquals("myList", field.getName());
assertEquals("java.util.List", field.getType().getIdentifier());
}
Aggregations