diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-06-30 09:48:14 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-07-01 09:43:03 +0200 |
commit | fac44e07465a57bd95a08379caf6ec1f767e8ec7 (patch) | |
tree | 35dd8c7aa3e711678571534dbacd31a3b136edf3 /testApi/src | |
parent | a16e101fad10d024a84aa36069ec6032fcbaf3e6 (diff) | |
download | dokka-fac44e07465a57bd95a08379caf6ec1f767e8ec7.tar.gz dokka-fac44e07465a57bd95a08379caf6ec1f767e8ec7.tar.bz2 dokka-fac44e07465a57bd95a08379caf6ec1f767e8ec7.zip |
Implement first simple JavadocModuleTemplateMapTest.kt
Diffstat (limited to 'testApi/src')
-rw-r--r-- | testApi/src/main/kotlin/testApi/utils/assertIsInstance.kt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testApi/src/main/kotlin/testApi/utils/assertIsInstance.kt b/testApi/src/main/kotlin/testApi/utils/assertIsInstance.kt new file mode 100644 index 00000000..0220799a --- /dev/null +++ b/testApi/src/main/kotlin/testApi/utils/assertIsInstance.kt @@ -0,0 +1,17 @@ +package testApi.utils + +import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.contract + +@OptIn(ExperimentalContracts::class) +inline fun <reified T> assertIsInstance(obj: Any?): T { + contract { + returns() implies (obj is T) + } + + if (obj is T) { + return obj + } + + throw AssertionError("Expected instance of type ${T::class.qualifiedName} but found $obj") +}
\ No newline at end of file |