aboutsummaryrefslogtreecommitdiff
path: root/core/testdata/format/website-html/sampleWithAsserts.kt
diff options
context:
space:
mode:
Diffstat (limited to 'core/testdata/format/website-html/sampleWithAsserts.kt')
-rw-r--r--core/testdata/format/website-html/sampleWithAsserts.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/testdata/format/website-html/sampleWithAsserts.kt b/core/testdata/format/website-html/sampleWithAsserts.kt
index bb9732d5..f5b03eb8 100644
--- a/core/testdata/format/website-html/sampleWithAsserts.kt
+++ b/core/testdata/format/website-html/sampleWithAsserts.kt
@@ -1,3 +1,6 @@
+import java.io.FileNotFoundException
+import java.io.File
+
/**
* @sample sample
*/
@@ -9,7 +12,16 @@ fun b(): String {
return "Hello, Rest"
}
+/**
+ * @throws FileNotFoundException every time
+ */
+fun readSomeFile(f: File) {
+ throw FileNotFoundException("BOOM")
+}
+
fun sample() {
assertPrints(a(), "Hello, Work")
assertTrue(a() == b())
+ assertFails("reading file now") { readSomeFile(File("some.txt")) }
+ assertFailsWith<FileNotFoundException> { readSomeFile(File("some.txt")) }
} \ No newline at end of file