generate for in range

This commit is contained in:
Dmitry Jemerov
2011-05-20 14:26:49 +02:00
parent 4c7768b47d
commit 8cf0524268
3 changed files with 155 additions and 49 deletions
@@ -92,6 +92,14 @@ public class ControlStructuresTest extends CodegenTestCase {
assertEquals("IntelliJ IDEA", main.invoke(null, new Object[] { args }));
}
public void testForInRange() throws Exception {
loadText("fun foo(sb: StringBuilder) { for(x in 1..4) sb.append(x) }");
final Method main = generateFunction();
StringBuilder stringBuilder = new StringBuilder();
main.invoke(null, stringBuilder);
assertEquals("1234", stringBuilder.toString());
}
public void testThrowCheckedException() throws Exception {
loadText("fun foo() { throw new Exception(); }");
final Method main = generateFunction();