aboutsummaryrefslogtreecommitdiff
path: root/core/testdata
diff options
context:
space:
mode:
Diffstat (limited to 'core/testdata')
-rw-r--r--core/testdata/format/website-html/sampleWithAsserts.html5
-rw-r--r--core/testdata/format/website-html/sampleWithAsserts.kt12
2 files changed, 16 insertions, 1 deletions
diff --git a/core/testdata/format/website-html/sampleWithAsserts.html b/core/testdata/format/website-html/sampleWithAsserts.html
index 012f91ab..7d014dbb 100644
--- a/core/testdata/format/website-html/sampleWithAsserts.html
+++ b/core/testdata/format/website-html/sampleWithAsserts.html
@@ -2,11 +2,14 @@
<h1>a</h1>
<a name="$a()"></a>
<div class="signature"><code><span class="keyword">fun </span><span class="identifier">a</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">String</span></code></div>
-<div class="sample"><pre><code class="lang-kotlin">
+<div class="sample"><pre><code class="lang-kotlin">import java.io.FileNotFoundException
+import java.io.File
fun main(args: Array<String>) {
//sampleStart
println(a()) // Hello, Work
println("a() == b() is ${a() == b()}") // true
+// readSomeFile(File("some.txt")) // reading file now will fail
+// readSomeFile(File("some.txt")) // will fail with FileNotFoundException
//sampleEnd
}</code></pre></div>
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