mirror of
https://github.com/logseq/logseq.git
synced 2026-05-21 19:24:17 +00:00
fix(cli): preserve deep preview values
This commit is contained in:
@@ -8,8 +8,7 @@
|
||||
|
||||
(defn- bounded-pr-str
|
||||
[value limit]
|
||||
(binding [*print-length* (inc limit)
|
||||
*print-level* 4]
|
||||
(binding [*print-length* (inc limit)]
|
||||
(pr-str value)))
|
||||
|
||||
(defn truncate-preview
|
||||
|
||||
@@ -31,6 +31,14 @@
|
||||
(is (= "nil" (:preview result)))
|
||||
(is (false? (:truncated? result)))))
|
||||
|
||||
(testing "preserves deep values when the preview limit is large enough"
|
||||
(let [value {:a {:b {:c {:d {:e 1}}}}}
|
||||
expected (pr-str value)
|
||||
result (cli-log/truncate-preview value 1000)]
|
||||
(is (= expected (:preview result)))
|
||||
(is (= (count expected) (:length result)))
|
||||
(is (false? (:truncated? result)))))
|
||||
|
||||
(testing "does not realize a full lazy collection for a short preview"
|
||||
(let [realized (atom 0)
|
||||
value (map (fn [n]
|
||||
|
||||
Reference in New Issue
Block a user