fields with final modifier converted to val

This commit is contained in:
Sergey Ignatov
2011-11-02 18:27:02 +04:00
parent f73923e4d3
commit bbd282e57b
5 changed files with 54 additions and 14 deletions
@@ -0,0 +1,30 @@
package org.jetbrains.jet.j2k.ast;
import junit.framework.Assert;
import org.jetbrains.jet.j2k.JetTestCaseBase;
/**
* @author ignatov
*/
public class FieldTest extends JetTestCaseBase {
public void testVarWithoutInit() throws Exception {
Assert.assertEquals(
methodToSingleLineKotlin("Foo f;"),
"var f : Foo?"
);
}
public void testVarWithInit() throws Exception {
Assert.assertEquals(
methodToSingleLineKotlin("Foo f = new Foo(1, 2);"),
"var f : Foo? = Foo(1, 2)"
);
}
public void testValWithInit() throws Exception {
Assert.assertEquals(
methodToSingleLineKotlin("final Foo f = new Foo(1, 2);"),
"val f : Foo? = Foo(1, 2)"
);
}
}