[Wasm] Add box and stdlib tests in wasi mode

This commit is contained in:
Igor Yakovlev
2023-07-31 15:46:48 +02:00
committed by Zalim Bashorov
parent f42d0b1ed4
commit 983991d46c
37 changed files with 560 additions and 93 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ public enum class TestPlatform {
Jvm,
Js,
Native,
Wasm;
WasmJs,
WasmWasi;
companion object
}
@@ -6,6 +6,8 @@
@file:Suppress("INVISIBLE_MEMBER")
package test.time
import test.TestPlatform
import test.current
import test.numbers.assertAlmostEquals
import kotlin.math.nextDown
import kotlin.math.pow
@@ -609,6 +611,8 @@ class DurationTest {
@Test
fun parseAndFormatInUnits() {
if (TestPlatform.current == TestPlatform.WasmWasi) return
var d = 1.days + 15.hours + 31.minutes + 45.seconds +
678.milliseconds + 920.microseconds + 516.34.nanoseconds
@@ -5,6 +5,8 @@
package test.time
import test.TestPlatform
import test.current
import kotlin.math.sign
import kotlin.test.*
import kotlin.time.*
@@ -367,6 +369,8 @@ class TimeMarkTest {
@Test
fun defaultTimeMarkAdjustmentBig() {
if (TestPlatform.current == TestPlatform.WasmWasi) return
testAdjustmentBig(TimeSource.Monotonic)
// do the same with specialized methods
@@ -397,6 +401,8 @@ class TimeMarkTest {
@Test
fun defaultTimeMarkAdjustmentInfinite() {
if (TestPlatform.current == TestPlatform.WasmWasi) return
testAdjustmentInfinite(TimeSource.Monotonic)
// do the same with specialized methods
+1 -1
View File
@@ -18,7 +18,7 @@ configureWasmStdLib(
wasmTargetParameter = "wasm-js",
wasmTargetAttribute = KotlinWasmTargetAttribute.js,
targetDependentSources = targetDependentSources,
targetDependentTestSources = listOf("$rootDir/libraries/stdlib/wasm/testJs/"),
targetDependentTestSources = listOf("$rootDir/libraries/stdlib/wasm/js/test/"),
kotlinTestDependencyName = ":kotlin-test:kotlin-test-wasm-js"
) { extensionBody ->
kotlin(extensionBody)
@@ -0,0 +1,8 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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
public actual val TestPlatform.Companion.current: TestPlatform get() = TestPlatform.WasmJs
-2
View File
@@ -12,8 +12,6 @@ public actual fun assertTypeEquals(expected: Any?, actual: Any?) {
assertEquals(expected?.let { it::class }, actual?.let { it::class })
}
public actual val TestPlatform.Companion.current: TestPlatform get() = TestPlatform.Wasm
// TODO: See KT-24975
public actual val isFloat32RangeEnforced: Boolean = false
+1 -1
View File
@@ -16,7 +16,7 @@ configureWasmStdLib(
wasmTargetParameter = "wasm-wasi",
wasmTargetAttribute = KotlinWasmTargetAttribute.wasi,
targetDependentSources = targetDependentSources,
targetDependentTestSources = emptyList(),
targetDependentTestSources = listOf("$rootDir/libraries/stdlib/wasm/wasi/test/"),
kotlinTestDependencyName = ":kotlin-test:kotlin-test-wasm-wasi"
) { extensionBody ->
kotlin(extensionBody)
@@ -0,0 +1,8 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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
public actual val TestPlatform.Companion.current: TestPlatform get() = TestPlatform.WasmWasi