generate augmented assignments to local variables

This commit is contained in:
Dmitry Jemerov
2011-04-08 16:58:04 +02:00
parent 639dd0f53a
commit 2eea2a6d9f
3 changed files with 37 additions and 0 deletions
@@ -413,6 +413,12 @@ public class NamespaceGenTest extends LightCodeInsightFixtureTestCase {
binOpTest("fun foo(a: Double, b: Int): Double = a + b", 1.0, 2, 3.0);
}
public void testAugAssign() throws Exception {
loadText("fun foo(a: Int): Int { var x = a; x += 5; return x; }");
final Method main = generateFunction();
assertEquals(10, main.invoke(null, 5));
}
private void binOpTest(final String text, final Object arg1, final Object arg2, final Object expected) throws Exception {
loadText(text);
System.out.println(generateToText());