Introduce expects in common wasm sources actualized in wasmJs and wasmWasi
This commit is contained in:
committed by
Space Team
parent
943c11d239
commit
6d62119659
+1
-1
@@ -14,7 +14,7 @@ private external fun d8Arguments(): String
|
||||
@JsFun("() => (typeof process != 'undefined' && typeof process.argv != 'undefined') ? process.argv.slice(2).join(' ') : ''")
|
||||
private external fun nodeArguments(): String
|
||||
|
||||
internal fun getArguments(): List<String> = (d8Arguments().ifEmpty { nodeArguments() }).split(' ')
|
||||
internal actual fun getArguments(): List<String> = (d8Arguments().ifEmpty { nodeArguments() }).split(' ')
|
||||
|
||||
internal class TeamcityAdapterWithPromiseSupport : TeamcityAdapter() {
|
||||
private var scheduleNextTaskAfter: Promise<JsAny?>? = null
|
||||
|
||||
@@ -20,7 +20,7 @@ internal var currentAdapter: FrameworkAdapter? = null
|
||||
private fun isJasmine(): Boolean =
|
||||
js("typeof describe === 'function' && typeof it === 'function'")
|
||||
|
||||
internal fun adapter(): FrameworkAdapter {
|
||||
internal actual fun adapter(): FrameworkAdapter {
|
||||
val result = currentAdapter ?: if (isJasmine()) JasmineLikeAdapter() else TeamcityAdapterWithPromiseSupport()
|
||||
currentAdapter = result
|
||||
return result
|
||||
|
||||
@@ -7,6 +7,8 @@ package kotlin.test
|
||||
|
||||
import kotlin.math.abs
|
||||
|
||||
internal expect fun getArguments(): List<String>
|
||||
|
||||
internal open class TeamcityAdapter : FrameworkAdapter {
|
||||
protected open fun runOrScheduleNext(block: () -> Unit) = block()
|
||||
protected open fun runOrScheduleNextWithResult(block: () -> Any?) = block()
|
||||
|
||||
@@ -7,6 +7,9 @@ package kotlin.test
|
||||
|
||||
import kotlin.wasm.WasmExport
|
||||
|
||||
|
||||
internal expect fun adapter(): FrameworkAdapter
|
||||
|
||||
/**
|
||||
* The functions below are used by the compiler to describe the tests structure, e.g.
|
||||
*
|
||||
|
||||
@@ -27,7 +27,7 @@ private external fun wasiRawArgsSizesGet(
|
||||
): Int
|
||||
|
||||
@OptIn(UnsafeWasmMemoryApi::class)
|
||||
internal fun getArguments(): List<String> = withScopedMemoryAllocator { allocator ->
|
||||
internal actual fun getArguments(): List<String> = withScopedMemoryAllocator { allocator ->
|
||||
val numberOfArgumentsPtr = allocator.allocate(4)
|
||||
val sizeOfArgumentStringPtr = allocator.allocate(4)
|
||||
val argNumRes = wasiRawArgsSizesGet(
|
||||
|
||||
@@ -7,4 +7,4 @@ package kotlin.test
|
||||
|
||||
private val currentAdapter: FrameworkAdapter by lazy { TeamcityAdapter() }
|
||||
|
||||
internal fun adapter(): FrameworkAdapter = currentAdapter
|
||||
internal actual fun adapter(): FrameworkAdapter = currentAdapter
|
||||
Reference in New Issue
Block a user