Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/clojure/core_test/add_watch.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
(swap! x inc)
(catch #?(:cljr clojure.lang.ExceptionInfo
:lpy basilisp.lang.exception/ExceptionInfo
:phel Phel.Lang.ExInfoException
:phel Phel.Lang.ExceptionInfo
:cljs :default
:clj clojure.lang.ExceptionInfo) e
(let [data (ex-data e)]
Expand Down
40 changes: 21 additions & 19 deletions test/clojure/core_test/group_by.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,25 @@

)

(testing "metadata"
;; Metadata shouldn't participate in the comparison
(let [g (group-by first [[^:foo [1] [2]] [^:bar [1] [3]]])]
(is (= {[1] [[[1] [2]] [[1] [3]]]} g))
;; Metadata should be preserved on grouped items
(is (= {:foo true} (-> g (get [1]) first first meta)))
(is (= {:bar true} (-> g (get [1]) second first meta))))
#?(:phel nil ;; phel does not propagate metadata through group-by
:default
(testing "metadata"
;; Metadata shouldn't participate in the comparison
(let [g (group-by first [[^:foo [1] [2]] [^:bar [1] [3]]])]
(is (= {[1] [[[1] [2]] [[1] [3]]]} g))
;; Metadata should be preserved on grouped items
(is (= {:foo true} (-> g (get [1]) first first meta)))
(is (= {:bar true} (-> g (get [1]) second first meta))))

;; Metadata should also be preserved on items and items should
;; stay in the order of the initial collection
(let [s (group-by empty? [^:a [] ^:b [1] ^:c [] ^:d [2]])]
;; validate grouping
(is (= s {true [[] []] false [[1] [2]]}))
;; validate order of items in each grouping using attached
;; metadata, which also validates that metadata is preserved
;; on items
(is (= {:a true} (-> s (get true) first meta)))
(is (= {:c true} (-> s (get true) second meta)))
(is (= {:b true} (-> s (get false) first meta)))
(is (= {:d true} (-> s (get false) second meta)))))))
;; Metadata should also be preserved on items and items should
;; stay in the order of the initial collection
(let [s (group-by empty? [^:a [] ^:b [1] ^:c [] ^:d [2]])]
;; validate grouping
(is (= s {true [[] []] false [[1] [2]]}))
;; validate order of items in each grouping using attached
;; metadata, which also validates that metadata is preserved
;; on items
(is (= {:a true} (-> s (get true) first meta)))
(is (= {:c true} (-> s (get true) second meta)))
(is (= {:b true} (-> s (get false) first meta)))
(is (= {:d true} (-> s (get false) second meta))))))))
10 changes: 6 additions & 4 deletions test/clojure/core_test/repeatedly.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@

(testing "Single argument"
(is (= 0 (first (repeatedly +))))
(testing "is lazy"
(let [call (repeatedly identity)]
(is (not (realized? call)))
(is (p/lazy-seq? call)))))
#?(:phel nil ;; phel's ConstantFolder evaluates (repeatedly identity) at compile time, calling identity with 0 args
:default
(testing "is lazy"
(let [call (repeatedly identity)]
(is (not (realized? call)))
(is (p/lazy-seq? call))))))

(testing "Two arguments"
(testing "is lazy"
Expand Down
Loading