Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mk committed Aug 25, 2023
1 parent d5af6cc commit cb8b695
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/nextjournal/clerk/eval_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,16 @@
(testing "class is not cachable"
(is (not (#'eval/cachable-value? java.lang.String)))
(is (not (#'eval/cachable-value? {:foo java.lang.String})))))

(deftest show!-test
(testing "in-memory cache is preserved when exception is thrown (#549)"
(let [code "{:f inc :n (rand-int 100000)}"
get-result #(:blob->result @nextjournal.clerk.webserver/!doc)]
(clerk/show! (java.io.StringReader. code))
(let [result-first-run (get-result)]
(try (clerk/show! (java.io.StringReader. (str code " (throw (ex-info \"boom\" {}))")))
(catch Exception _ nil))
(clerk/show! (java.io.StringReader. code))
(is (= result-first-run (get-result)))))))


0 comments on commit cb8b695

Please sign in to comment.