Make several tests running on JS backend.
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
import java.util.Arrays
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
abstract class A {
|
||||
abstract fun foo(): List<String>
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(): ArrayList<String> = ArrayList(Arrays.asList("B"))
|
||||
fun foo(): ArrayList<String> = ArrayList(listOf("B"))
|
||||
}
|
||||
|
||||
open class C : A(), B {
|
||||
|
||||
+2
-4
@@ -1,6 +1,4 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
import java.util.Arrays
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface A {
|
||||
fun foo(): Collection<String>
|
||||
@@ -11,7 +9,7 @@ interface B : A {
|
||||
}
|
||||
|
||||
class C : B {
|
||||
override fun foo(): MutableList<String> = ArrayList(Arrays.asList("C"))
|
||||
override fun foo(): MutableList<String> = ArrayList(listOf("C"))
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
+4
-12
@@ -1,22 +1,14 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.Arrays
|
||||
import java.util.Collections
|
||||
import java.util.Comparator
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun sort(list: MutableList<String>, comparator: (String, String) -> Int) {
|
||||
Collections.sort(list, object : Comparator<String> {
|
||||
override fun compare(p0: String, p1: String) = comparator(p0, p1)
|
||||
})
|
||||
list.sortWith(Comparator(comparator))
|
||||
}
|
||||
|
||||
fun compare(s1: String, s2: String) = s1.compareTo(s2)
|
||||
|
||||
fun box(): String {
|
||||
val l = ArrayList(Arrays.asList("d", "b", "c", "e", "a"))
|
||||
val l = mutableListOf("d", "b", "c", "e", "a")
|
||||
sort(l, ::compare)
|
||||
if (l != Arrays.asList("a", "b", "c", "d", "e")) return "Fail: $l"
|
||||
if (l != listOf("a", "b", "c", "d", "e")) return "Fail: $l"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.*
|
||||
|
||||
class Itr : Iterator<String> by ArrayList<String>().iterator()
|
||||
class MItr : MutableIterator<String> by ArrayList<String>().iterator()
|
||||
class LItr : ListIterator<String> by ArrayList<String>().listIterator()
|
||||
@@ -37,7 +32,7 @@ inline fun asFailsWithCCE(operation: String, block: () -> Unit) {
|
||||
try {
|
||||
block()
|
||||
}
|
||||
catch (e: java.lang.ClassCastException) {
|
||||
catch (e: ClassCastException) {
|
||||
return
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.*
|
||||
|
||||
class Itr : Iterator<String> by ArrayList<String>().iterator()
|
||||
class MItr : MutableIterator<String> by ArrayList<String>().iterator()
|
||||
class LItr : ListIterator<String> by ArrayList<String>().listIterator()
|
||||
@@ -33,6 +28,8 @@ class MME : MutableMap.MutableEntry<String, String> {
|
||||
override fun setValue(value: String): String = throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())}
|
||||
|
||||
fun box(): String {
|
||||
val itr = Itr() as Any
|
||||
val mitr = MItr()
|
||||
|
||||
+1
-6
@@ -1,10 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.*
|
||||
|
||||
class Itr : Iterator<String> by ArrayList<String>().iterator()
|
||||
class MItr : MutableIterator<String> by ArrayList<String>().iterator()
|
||||
class LItr : ListIterator<String> by ArrayList<String>().listIterator()
|
||||
@@ -46,7 +41,7 @@ inline fun <reified T> reifiedAsFailsWithCCE(x: Any, operation: String) {
|
||||
try {
|
||||
x as T
|
||||
}
|
||||
catch (e: java.lang.ClassCastException) {
|
||||
catch (e: ClassCastException) {
|
||||
return
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
|
||||
+2
-5
@@ -1,10 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.*
|
||||
|
||||
class Itr : Iterator<String> by ArrayList<String>().iterator()
|
||||
class MItr : MutableIterator<String> by ArrayList<String>().iterator()
|
||||
class LItr : ListIterator<String> by ArrayList<String>().listIterator()
|
||||
@@ -36,6 +31,8 @@ class MME : MutableMap.MutableEntry<String, String> {
|
||||
inline fun <reified T> reifiedIs(x: Any): Boolean = x is T
|
||||
inline fun <reified T> reifiedIsNot(x: Any): Boolean = x !is T
|
||||
|
||||
fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())}
|
||||
|
||||
fun box(): String {
|
||||
val itr = Itr() as Any
|
||||
val mitr = MItr()
|
||||
|
||||
+3
-5
@@ -1,10 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.*
|
||||
|
||||
class Itr : Iterator<String> by ArrayList<String>().iterator()
|
||||
class MItr : MutableIterator<String> by ArrayList<String>().iterator()
|
||||
class LItr : ListIterator<String> by ArrayList<String>().listIterator()
|
||||
@@ -33,6 +28,9 @@ class MME : MutableMap.MutableEntry<String, String> {
|
||||
override fun setValue(value: String): String = throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
fun assert(condition: Boolean, message: () -> String) { if (!condition) throw AssertionError(message())}
|
||||
|
||||
|
||||
inline fun safeAsReturnsNull(operation: String, cast: () -> Any?) {
|
||||
try {
|
||||
val x = cast()
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.Arrays
|
||||
|
||||
fun foo(): List<String>? = Arrays.asList("abcde")
|
||||
fun foo(): List<String>? = listOf("abcde")
|
||||
|
||||
fun box(): String {
|
||||
for (i in 1..3) {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import java.util.*
|
||||
// WITH_RUNTIME
|
||||
|
||||
class A() {
|
||||
infix fun <T> ArrayList<T>.add3(el: T) = add(el)
|
||||
@@ -22,6 +19,6 @@ fun box() : String{
|
||||
list add2 i
|
||||
}
|
||||
A().test(list)
|
||||
System.out?.println(list)
|
||||
println(list)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
fun box() : String {
|
||||
val array = ArrayList<String>()
|
||||
@@ -14,7 +10,7 @@ fun box() : String {
|
||||
|
||||
var <T> ArrayList<T>.length : Int
|
||||
get() = size
|
||||
set(value: Int) = throw java.lang.Error()
|
||||
set(value: Int) = throw Error()
|
||||
|
||||
var <T> ArrayList<T>.last : T
|
||||
get() = get(size-1)!!
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import java.util.*
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
val list = ArrayList(Arrays.asList(3, 2, 4, 8, 1, 5))
|
||||
val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1))
|
||||
Collections.sort(list, Comparator { a, b -> b - a })
|
||||
val list = mutableListOf(3, 2, 4, 8, 1, 5)
|
||||
val expected = listOf(8, 5, 4, 3, 2, 1)
|
||||
list.sortWith(Comparator { a, b -> b - a })
|
||||
return if (list == expected) "OK" else list.toString()
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import java.util.*
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
val list = ArrayList(Arrays.asList(3, 2, 4, 8, 1, 5))
|
||||
val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1))
|
||||
val list = mutableListOf(3, 2, 4, 8, 1, 5)
|
||||
val expected = listOf(8, 5, 4, 3, 2, 1)
|
||||
val comparatorFun: (Int, Int) -> Int = { a, b -> b - a }
|
||||
Collections.sort(list, Comparator(comparatorFun))
|
||||
list.sortWith(Comparator(comparatorFun))
|
||||
return if (list == expected) "OK" else list.toString()
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.ArrayList
|
||||
import java.util.Arrays
|
||||
|
||||
fun box(): String {
|
||||
val list = ArrayList<Pair<String,String>>()
|
||||
list.add(Pair("Sample", "http://cyber.law.harvard.edu/rss/examples/rss2sample.xml"))
|
||||
@@ -13,7 +7,7 @@ fun box(): String {
|
||||
|
||||
val keys = list.map { it.first }.toTypedArray<String>()
|
||||
|
||||
val keysToString = Arrays.toString(keys)
|
||||
val keysToString = keys.contentToString()
|
||||
if (keysToString != "[Sample, Scripting]") return keysToString
|
||||
|
||||
return "OK"
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// WITH_RUNTIME
|
||||
|
||||
import java.util.Arrays
|
||||
|
||||
fun getCopyToArray(): Array<Int> = Arrays.asList(2, 3, 9).toTypedArray()
|
||||
fun getCopyToArray(): Array<Int> = listOf(2, 3, 9).toTypedArray()
|
||||
|
||||
fun box(): String {
|
||||
val str = Arrays.toString(getCopyToArray())
|
||||
val str = getCopyToArray().contentToString()
|
||||
if (str != "[2, 3, 9]") return str
|
||||
|
||||
return "OK"
|
||||
|
||||
+15
-105
@@ -1226,13 +1226,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("complexTraitImpl.kt")
|
||||
public void testComplexTraitImpl() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("delegation.kt")
|
||||
@@ -1388,13 +1382,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("noBridgeOnMutableCollectionInheritance.kt")
|
||||
public void testNoBridgeOnMutableCollectionInheritance() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/noBridgeOnMutableCollectionInheritance.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideAbstractProperty.kt")
|
||||
@@ -2237,13 +2225,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("sortListOfStrings.kt")
|
||||
public void testSortListOfStrings() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/function/sortListOfStrings.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFromClass.kt")
|
||||
@@ -2999,25 +2981,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("asWithMutable.kt")
|
||||
public void testAsWithMutable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/casts/mutableCollections/asWithMutable.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("isWithMutable.kt")
|
||||
public void testIsWithMutable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/casts/mutableCollections/isWithMutable.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("mutabilityMarkerInterfaces.kt")
|
||||
@@ -3035,25 +3005,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("reifiedAsWithMutable.kt")
|
||||
public void testReifiedAsWithMutable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/casts/mutableCollections/reifiedAsWithMutable.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reifiedIsWithMutable.kt")
|
||||
public void testReifiedIsWithMutable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/casts/mutableCollections/reifiedIsWithMutable.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reifiedSafeAsWithMutable.kt")
|
||||
@@ -3065,13 +3023,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("safeAsWithMutable.kt")
|
||||
public void testSafeAsWithMutable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/casts/mutableCollections/safeAsWithMutable.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("weirdMutableCasts.kt")
|
||||
@@ -4578,13 +4530,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("continueInForCondition.kt")
|
||||
public void testContinueInForCondition() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/continueInForCondition.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("continueInWhile.kt")
|
||||
@@ -4872,13 +4818,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("kt513.kt")
|
||||
public void testKt513() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/kt513.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt628.kt")
|
||||
@@ -7809,13 +7749,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("kt475.kt")
|
||||
public void testKt475() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/extensionFunctions/kt475.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt5467.kt")
|
||||
@@ -18935,13 +18869,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("comparator.kt")
|
||||
public void testComparator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/sam/constructors/comparator.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("filenameFilter.kt")
|
||||
@@ -18959,13 +18887,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("nonLiteralComparator.kt")
|
||||
public void testNonLiteralComparator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/sam/constructors/nonLiteralComparator.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nonLiteralFilenameFilter.kt")
|
||||
@@ -20175,25 +20097,13 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
@TestMetadata("kt3177-toTypedArray.kt")
|
||||
public void testKt3177_toTypedArray() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/toArray/kt3177-toTypedArray.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("returnToTypedArray.kt")
|
||||
public void testReturnToTypedArray() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/toArray/returnToTypedArray.kt");
|
||||
try {
|
||||
doTest(fileName);
|
||||
}
|
||||
catch (Throwable ignore) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("toTypedArray.kt")
|
||||
|
||||
Reference in New Issue
Block a user