failing test

This commit is contained in:
Dmitry Jemerov
2011-04-07 12:14:25 +02:00
parent dc326ca3cd
commit e61e908ab7
2 changed files with 13 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
fun f(x: Int, b: Boolean): Int {
var result = x;
if (b) else result = result + 5;
return result;
}
@@ -180,6 +180,14 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
binOpTest("fun foo(a: Int, b: Int): Int = a % b", 14, 3, 2);
}
public void testIfNoElse() throws Exception {
loadFile("ifNoElse.jet");
System.out.println(generateToText());
final Method main = generateFunction();
assertEquals(5, main.invoke(null, 5, true));
assertEquals(10, main.invoke(null, 5, false));
}
private void binOpTest(final String text, final int arg1, final int arg2, final int expected) throws Exception {
loadText(text);
System.out.println(generateToText());