aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/expect
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-30 15:58:46 +0200
committerGitHub <noreply@github.com>2023-08-30 15:58:46 +0200
commitc63ea36637ce956029fb15b1482c0683ecb8a587 (patch)
tree2b75a8a976b43530820e73dc60cce4b10d9fc005 /plugins/base/src/test/kotlin/expect
parent0e00edc6fcd406fcf38673ef6a2f8f59e8374de2 (diff)
downloaddokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.gz
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.tar.bz2
dokka-c63ea36637ce956029fb15b1482c0683ecb8a587.zip
Migrate to JUnit 5 and unify used test API (#3138)
Diffstat (limited to 'plugins/base/src/test/kotlin/expect')
-rw-r--r--plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt9
-rw-r--r--plugins/base/src/test/kotlin/expect/ExpectGenerator.kt8
-rw-r--r--plugins/base/src/test/kotlin/expect/ExpectTest.kt6
3 files changed, 12 insertions, 11 deletions
diff --git a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt
index 1d86f219..29905035 100644
--- a/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt
+++ b/plugins/base/src/test/kotlin/expect/AbstractExpectTest.kt
@@ -1,11 +1,12 @@
package expect
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
-import org.junit.jupiter.api.Assertions.assertTrue
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
import java.util.concurrent.TimeUnit
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
abstract class AbstractExpectTest(
val testDir: Path? = Paths.get("src/test", "resources", "expect"),
@@ -40,9 +41,9 @@ abstract class AbstractExpectTest(
).also { logger.info("git diff command: ${it.command().joinToString(" ")}") }
.also { it.redirectErrorStream() }.start()
- assertTrue(gitCompare.waitFor(gitTimeout, TimeUnit.MILLISECONDS)) { "Git timed out after $gitTimeout" }
+ assertTrue(gitCompare.waitFor(gitTimeout, TimeUnit.MILLISECONDS), "Git timed out after $gitTimeout")
gitCompare.inputStream.bufferedReader().lines().forEach { logger.info(it) }
- assertTrue(gitCompare.exitValue() == 0) { "${path.fileName}: outputs don't match" }
+ assertEquals(0, gitCompare.exitValue(), "${path.fileName}: outputs don't match")
} ?: throw AssertionError("obtained path is null")
}
@@ -54,7 +55,7 @@ abstract class AbstractExpectTest(
) {
obtained?.let { _ ->
val (res, out, err) = runDiff(expected, obtained, excludes, timeout)
- assertTrue(res == 0, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}")
+ assertEquals(0, res, "Outputs differ:\nstdout - $out\n\nstderr - ${err ?: ""}")
} ?: throw AssertionError("obtained path is null")
}
diff --git a/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt b/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt
index cb3313f9..4112cd28 100644
--- a/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt
+++ b/plugins/base/src/test/kotlin/expect/ExpectGenerator.kt
@@ -1,13 +1,13 @@
package expect
-import org.junit.jupiter.api.Disabled
-import org.junit.jupiter.api.Test
+import kotlin.test.Ignore
+import kotlin.test.Test
class ExpectGenerator : AbstractExpectTest() {
- @Disabled
+ @Ignore
@Test
fun generateAll() = testDir?.dirsWithFormats(formats).orEmpty().forEach { (p, f) ->
generateExpect(p, f)
}
-} \ No newline at end of file
+}
diff --git a/plugins/base/src/test/kotlin/expect/ExpectTest.kt b/plugins/base/src/test/kotlin/expect/ExpectTest.kt
index bed841a6..ec9c8c6d 100644
--- a/plugins/base/src/test/kotlin/expect/ExpectTest.kt
+++ b/plugins/base/src/test/kotlin/expect/ExpectTest.kt
@@ -1,8 +1,8 @@
package expect
-import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.DynamicTest.dynamicTest
import org.junit.jupiter.api.TestFactory
+import kotlin.test.Ignore
class ExpectTest : AbstractExpectTest() {
private val ignores: List<String> = listOf(
@@ -16,9 +16,9 @@ class ExpectTest : AbstractExpectTest() {
"*.map"
)
- @Disabled
+ @Ignore
@TestFactory
fun expectTest() = testDir?.dirsWithFormats(formats).orEmpty().map { (p, f) ->
dynamicTest("${p.fileName}-$f") { testOutputWithExcludes(p, f, ignores) }
}
-} \ No newline at end of file
+}