Do not reference java.util in tests that run on JS backend.
This commit is contained in:
+3
-3
@@ -1,17 +1,17 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import java.util.Arrays.equals
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
val s = arrayOf("live", "long")
|
||||
val t: Array<String> = s.clone()
|
||||
if (!equals(s, t)) return "Fail string"
|
||||
if (!(s contentEquals t)) return "Fail string"
|
||||
if (s === t) return "Fail string identity"
|
||||
|
||||
val ss = arrayOf(s, s)
|
||||
val tt: Array<Array<String>> = ss.clone()
|
||||
if (!equals(ss, tt)) return "Fail string[]"
|
||||
if (!(ss contentEquals tt)) return "Fail string[]"
|
||||
if (ss === tt) return "Fail string[] identity"
|
||||
|
||||
return "OK"
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
import java.util.Arrays.equals
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
val i = intArrayOf(1, 2)
|
||||
if (!equals(i, i.clone())) return "Fail int"
|
||||
if (!(i contentEquals i.clone())) return "Fail int"
|
||||
if (i.clone() === i) return "Fail int identity"
|
||||
|
||||
val j = longArrayOf(1L, 2L)
|
||||
if (!equals(j, j.clone())) return "Fail long"
|
||||
if (!(j contentEquals j.clone())) return "Fail long"
|
||||
if (j.clone() === j) return "Fail long identity"
|
||||
|
||||
val s = shortArrayOf(1.toShort(), 2.toShort())
|
||||
if (!equals(s, s.clone())) return "Fail short"
|
||||
if (!(s contentEquals s.clone())) return "Fail short"
|
||||
if (s.clone() === s) return "Fail short identity"
|
||||
|
||||
val b = byteArrayOf(1.toByte(), 2.toByte())
|
||||
if (!equals(b, b.clone())) return "Fail byte"
|
||||
if (!(b contentEquals b.clone())) return "Fail byte"
|
||||
if (b.clone() === b) return "Fail byte identity"
|
||||
|
||||
val c = charArrayOf('a', 'b')
|
||||
if (!equals(c, c.clone())) return "Fail char"
|
||||
if (!(c contentEquals c.clone())) return "Fail char"
|
||||
if (c.clone() === c) return "Fail char identity"
|
||||
|
||||
val d = doubleArrayOf(1.0, -1.0)
|
||||
if (!equals(d, d.clone())) return "Fail double"
|
||||
if (!(d contentEquals d.clone())) return "Fail double"
|
||||
if (d.clone() === d) return "Fail double identity"
|
||||
|
||||
val f = floatArrayOf(1f, -1f)
|
||||
if (!equals(f, f.clone())) return "Fail float"
|
||||
if (!(f contentEquals f.clone())) return "Fail float"
|
||||
if (f.clone() === f) return "Fail float identity"
|
||||
|
||||
val z = booleanArrayOf(true, false)
|
||||
if (!equals(z, z.clone())) return "Fail boolean"
|
||||
if (!(z contentEquals z.clone())) return "Fail boolean"
|
||||
if (z.clone() === z) return "Fail boolean identity"
|
||||
|
||||
return "OK"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
operator fun ArrayList<String>.get(index1: Int, index2: Int) = this[index1 + index2]
|
||||
operator fun ArrayList<String>.set(index1: Int, index2: Int, elem: String) {
|
||||
this[index1 + index2] = elem
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
operator fun ArrayList<String>.get(index1: Int, index2: Int) = this[index1 + index2]
|
||||
operator fun ArrayList<String>.set(index1: Int, index2: Int, elem: String) {
|
||||
this[index1 + index2] = elem
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import java.util.HashMap
|
||||
|
||||
operator fun HashMap<String, Int?>.set(index: String, elem: Int?) {
|
||||
this.put(index, elem)
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fun box () : String {
|
||||
val s = java.util.ArrayList<String>()
|
||||
val s = ArrayList<String>()
|
||||
s.add("foo")
|
||||
s[0] += "bar"
|
||||
return if(s[0] == "foobar") "OK" else "fail"
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import java.util.*
|
||||
|
||||
operator fun <K, V> MutableMap<K, V>.set(k : K, v : V) = put(k, v)
|
||||
|
||||
fun box() : String {
|
||||
|
||||
Reference in New Issue
Block a user