[Native][tests] Minor. Refactor AbstractRunner.RunResult
This commit is contained in:
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
package org.jetbrains.kotlin.konan.blackboxtest.support
|
package org.jetbrains.kotlin.konan.blackboxtest.support
|
||||||
|
|
||||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.runner.AbstractRunner
|
import org.jetbrains.kotlin.konan.blackboxtest.support.runner.RunResult
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.time.Duration
|
import kotlin.time.Duration
|
||||||
import kotlin.time.DurationUnit
|
import kotlin.time.DurationUnit
|
||||||
@@ -109,7 +109,7 @@ internal abstract class LoggedData {
|
|||||||
|
|
||||||
class TestRun(
|
class TestRun(
|
||||||
private val parameters: TestRunParameters,
|
private val parameters: TestRunParameters,
|
||||||
private val runResult: AbstractRunner.RunResult.Completed
|
private val runResult: RunResult.Completed
|
||||||
) : LoggedData() {
|
) : LoggedData() {
|
||||||
override fun computeText() = buildString {
|
override fun computeText() = buildString {
|
||||||
appendLine("TEST RUN:")
|
appendLine("TEST RUN:")
|
||||||
|
|||||||
-6
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.konan.blackboxtest.support.LoggedData
|
|||||||
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEquals
|
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertEquals
|
||||||
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertTrue
|
import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertTrue
|
||||||
import org.jetbrains.kotlin.test.services.JUnit5Assertions.fail
|
import org.jetbrains.kotlin.test.services.JUnit5Assertions.fail
|
||||||
import kotlin.time.Duration
|
|
||||||
|
|
||||||
internal abstract class AbstractRunner<R> {
|
internal abstract class AbstractRunner<R> {
|
||||||
protected abstract fun buildRun(): AbstractRun
|
protected abstract fun buildRun(): AbstractRun
|
||||||
@@ -42,11 +41,6 @@ internal abstract class AbstractRunner<R> {
|
|||||||
fun run(): RunResult
|
fun run(): RunResult
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed interface RunResult {
|
|
||||||
data class Completed(val exitCode: Int, val duration: Duration, val stdOut: String, val stdErr: String) : RunResult
|
|
||||||
data class TimeoutExceeded(val timeout: Duration) : RunResult
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract inner class ResultHandler(protected val runResult: RunResult.Completed) {
|
abstract inner class ResultHandler(protected val runResult: RunResult.Completed) {
|
||||||
abstract fun getLoggedRun(): LoggedData
|
abstract fun getLoggedRun(): LoggedData
|
||||||
abstract fun handle(): R
|
abstract fun handle(): R
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 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 org.jetbrains.kotlin.konan.blackboxtest.support.runner
|
||||||
|
|
||||||
|
import kotlin.time.Duration
|
||||||
|
|
||||||
|
sealed interface RunResult {
|
||||||
|
data class Completed(val exitCode: Int, val duration: Duration, val stdOut: String, val stdErr: String) : RunResult
|
||||||
|
data class TimeoutExceeded(val timeout: Duration) : RunResult
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user