Skip to content

Commit 38657af

Browse files
committed
Add test
1 parent 2aa4bb1 commit 38657af

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/nextjournal/clerk/eval_test.clj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,23 @@
322322
(is (match? {:blocks [{:type :code,
323323
:result {:nextjournal/value "foo"}}]}
324324
(eval/eval-string "(re-find '#\"foo\" \"foobar\")"))))
325+
326+
(deftest issue-781-var-snapshot-test
327+
(let [notebook (fn [cache?]
328+
(format "(ns parsing-extensibility
329+
{:nextjournal.clerk/toc :collapsed
330+
:nextjournal.clerk/no-cache %s}
331+
(:require [nextjournal.clerk :as clerk]))
332+
333+
^{:nextjournal.clerk/visibility {:code :hide :result :hide}}
334+
(def show-text
335+
{:transform-fn (fn [x] (clerk/html [:pre (:nextjournal/value x)]))})
336+
337+
^{::clerk/visibility {:code :hide} ::clerk/viewer show-text}
338+
(def x 1)"
339+
(not cache?)))]
340+
(doseq [cache? [true #_false]]
341+
(is (match? {:nextjournal.clerk/var-from-def var?
342+
:nextjournal.clerk/var-snapshot 1}
343+
(-> (eval/eval-string (notebook cache?))
344+
:blocks last :result :nextjournal/value))))))

0 commit comments

Comments
 (0)