stdlib tests: provide expect/actual helper functions
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package test.collections.js
|
||||
|
||||
public actual fun <V> stringMapOf(vararg pairs: Pair<String, V>): HashMap<String, V> = kotlin.collections.stringMapOf(*pairs)
|
||||
public actual fun <V> linkedStringMapOf(vararg pairs: Pair<String, V>): LinkedHashMap<String, V> = kotlin.collections.linkedStringMapOf(*pairs)
|
||||
public actual fun stringSetOf(vararg elements: String): HashSet<String> = kotlin.collections.stringSetOf(*elements)
|
||||
public actual fun linkedStringSetOf(vararg elements: String): LinkedHashSet<String> = kotlin.collections.linkedStringSetOf(*elements)
|
||||
@@ -18,13 +18,13 @@ package test
|
||||
|
||||
import kotlin.test.*
|
||||
|
||||
public fun assertTypeEquals(expected: Any?, actual: Any?) {
|
||||
public actual fun assertTypeEquals(expected: Any?, actual: Any?) {
|
||||
assertEquals(expected?.let { it::class.js }, actual?.let { it::class.js })
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
public fun randomInt(limit: Int): Int = (kotlin.js.Math.random() * limit).toInt()
|
||||
public actual fun randomInt(limit: Int): Int = (kotlin.js.Math.random() * limit).toInt()
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
internal inline fun String.removeLeadingPlusOnJava6(): String = this
|
||||
internal fun doubleTotalOrderEquals(a: Double?, b: Double?) = a == b || (a != a && b != b)
|
||||
internal actual inline fun String.removeLeadingPlusOnJava6(): String = this
|
||||
internal actual fun doubleTotalOrderEquals(a: Double?, b: Double?) = a == b || (a != a && b != b)
|
||||
|
||||
Reference in New Issue
Block a user