simplest case of enum classes

This commit is contained in:
Dmitry Jemerov
2011-07-12 18:18:08 +02:00
parent 57f4f664ba
commit f44ac29cde
4 changed files with 61 additions and 4 deletions
@@ -1,5 +1,6 @@
package org.jetbrains.jet.codegen;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
@@ -130,4 +131,13 @@ public class ClassGenTest extends CodegenTestCase {
Object result = method.invoke(null);
assertInstanceOf(result, Runnable.class);
}
public void testEnumClass() throws Exception {
loadText("enum class Direction { NORTH; SOUTH; EAST; WEST }");
System.out.println(generateToText());
final Class direction = loadAllClasses(generateClassesInFile()).get("Direction");
final Field north = direction.getField("NORTH");
assertEquals(direction, north.getType());
assertInstanceOf(north.get(null), direction);
}
}