JS backend: added tests that checks constructing ArrayList with capacity.
This commit is contained in:
@@ -68,4 +68,12 @@ public final class ArrayListTest extends JavaClassesTest {
|
||||
public void testMisc() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testConstructWithCapacity() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testConstructWithSideEffectParam() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package foo
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
fun box(): Boolean {
|
||||
val al = ArrayList<Int>(10)
|
||||
return al.size() == 0
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package foo
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
var baz = 0
|
||||
fun withSideEffect(v: Int): Int {
|
||||
baz = v
|
||||
return v
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
val al = ArrayList<Int>(withSideEffect(2))
|
||||
return al.size() == 0 && baz == 2
|
||||
}
|
||||
Reference in New Issue
Block a user