New stdlib tests

- Unzip from the same test-data archive
- Add actual declarations
This commit is contained in:
Pavel Punegov
2018-07-25 17:49:45 +03:00
committed by Pavel Punegov
parent e717f45da1
commit bb44fdda88
3 changed files with 40 additions and 2 deletions
+14 -2
View File
@@ -123,7 +123,7 @@ task update_external_tests() {
// from(zipTree(it)) {
from(zipTree(file('/Users/ppunegov/ws/kotlin/dist/kotlin-test-data.zip'))) {
include 'compiler/**'
include('compiler/**', 'stdlib/**')
}
into(temporaryDir)
}
@@ -141,6 +141,16 @@ task update_external_tests() {
include 'compileKotlinAgainstKotlin/**'
}
externalStdlibTestsDir.mkdirs()
delete("${externalStdlibTestsDir.canonicalPath}/common")
delete("${externalStdlibTestsDir.canonicalPath}/test")
copy {
from temporaryDir.absolutePath + "/stdlib"
into(externalStdlibTestsDir)
include 'common/**'
include 'test/**'
}
//clean tmp dir.
delete temporaryDir
}
@@ -2930,7 +2940,9 @@ task runKonanRegexTests(type: RunKonanTest) {
task buildKonanStdlibTests(type: BuildKonanTest) {
outputSourceSetName = "testOutputStdlib"
compileList = [ "stdlib_external", "testUtils.kt" ]
flags = [ "-Xmulti-platform" ]
compileList = [ "stdlib_external/test", "stdlib_external/common",
"stdlib_external/utils.kt", "stdlib_external/jsCollectionFactoriesActuals.kt" ]
}
task runStdlibTests(type: RunStdlibTest) {
@@ -0,0 +1,11 @@
/*
* Copyright 2010-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
actual fun <V> stringMapOf(vararg pairs: Pair<String, V>): HashMap<String, V> = hashMapOf<String, V>(*pairs)
actual fun <V> linkedStringMapOf(vararg pairs: Pair<String, V>): LinkedHashMap<String, V> = linkedMapOf(*pairs)
actual fun stringSetOf(vararg elements: String): HashSet<String> = hashSetOf(*elements)
actual fun linkedStringSetOf(vararg elements: String): LinkedHashSet<String> = linkedSetOf(*elements)
@@ -0,0 +1,15 @@
package test
import kotlin.test.*
public actual fun assertTypeEquals(expected: Any?, actual: Any?) {
if (expected != null && actual != null) {
assertEquals(expected::class, actual::class)
} else {
assertTrue(expected == null && actual == null)
}
}
public actual fun randomInt(limit: Int): Int = kotlin.random.Random.nextInt(limit)
internal actual fun String.removeLeadingPlusOnJava6(): String = this