more advanced test
This commit is contained in:
@@ -75,12 +75,15 @@ public class PropertyGenTest extends CodegenTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testAccessorsWithoutBody() throws Exception {
|
public void testAccessorsWithoutBody() throws Exception {
|
||||||
loadText("class AccessorsWithoutBody { public var foo: Int = 349\n get\n private set } ");
|
loadText("class AccessorsWithoutBody { public var foo: Int = 349\n get\n private set\n fun setter() { foo = 610; } } ");
|
||||||
final Class aClass = loadImplementationClass(generateClassesInFile(), "AccessorsWithoutBody");
|
final Class aClass = loadImplementationClass(generateClassesInFile(), "AccessorsWithoutBody");
|
||||||
final Object instance = aClass.newInstance();
|
final Object instance = aClass.newInstance();
|
||||||
final Method getFoo = findMethodByName(aClass, "getFoo");
|
final Method getFoo = findMethodByName(aClass, "getFoo");
|
||||||
assertEquals(349, getFoo.invoke(instance));
|
assertEquals(349, getFoo.invoke(instance));
|
||||||
assertNull(findMethodByName(aClass, "setFoo"));
|
assertNull(findMethodByName(aClass, "setFoo"));
|
||||||
|
final Method setter = findMethodByName(aClass, "setter");
|
||||||
|
setter.invoke(instance);
|
||||||
|
assertEquals(610, getFoo.invoke(instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInitializersForNamespaceProperties() throws Exception {
|
public void testInitializersForNamespaceProperties() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user