initial commit (moved from divan)

This commit is contained in:
sergeych committed 2023-11-11 23:53:37 +03:00
commit 770555024f
56 files changed
+2745

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import kotlin.test.fail
inline fun <reified T: Throwable>assertThrows(f: ()->Unit): T {
val name = T::class.simpleName
try {
f()
fail("expected to throw $name but threw nothing")
}
catch(x: Throwable) {
if( x is T ) return x
fail("expected to throw $name but instead threw ${x::class.simpleName}: $x")
}
}