From 03329b0eb98b309d208839344052633028e00984 Mon Sep 17 00:00:00 2001 From: Szymon Świstun Date: Wed, 18 Mar 2020 14:19:54 +0100 Subject: Fix minor bugs and add core tests --- plugins/base/src/test/kotlin/utils/TestUtils.kt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/base/src/test/kotlin/utils/TestUtils.kt') diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt index 68ab7120..8a3053b3 100644 --- a/plugins/base/src/test/kotlin/utils/TestUtils.kt +++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt @@ -3,6 +3,7 @@ package utils import org.jetbrains.dokka.model.* import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest +import org.junit.jupiter.api.Assertions.assertTrue import kotlin.collections.orEmpty @DslMarker @@ -22,6 +23,10 @@ interface AssertDSL { infix fun Any?.equals(other: Any?) = this.assertEqual(other) infix fun Collection?.allEquals(other: Any?) = this?.also { c -> c.forEach { it equals other } } ?: run { assert(false) { "Collection is empty" } } + infix fun Collection?.exists(e: T) { + assertTrue(this.orEmpty().isNotEmpty(), "Collection cannot be null or empty") + assertTrue(this!!.any{it == e}, "Collection doesn't contain $e") + } infix fun Collection?.counts(n: Int) = this.orEmpty().assertCount(n) -- cgit