Skip to content

Commit 13d7f8c

Browse files
committed
cljs.metadata-test passing
- Vector uncovered a very old LazySeq bug where it returned meta after empty. Don't change for now, different path for `:lite-mode` - Use (.-EMPTY PersistentVector) instead [] for PersistentQueue
1 parent 9549fff commit 13d7f8c

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/main/cljs/cljs/core.cljs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3614,7 +3614,13 @@ reduces them without incurring seq initialization"
36143614
(-conj [coll o] (cons o coll))
36153615

36163616
IEmptyableCollection
3617-
(-empty [coll] (-with-meta (.-EMPTY List) meta))
3617+
(-empty [coll]
3618+
;; MAYBE FIXME: :lite-mode testing uncovered a very old bug, empty on seq
3619+
;; should discared the metadata, we change the behavior in LITE_MODE for now
3620+
;; to avoid a breaking change
3621+
(if-not ^boolean LITE_MODE
3622+
(-with-meta (.-EMPTY List) meta)
3623+
(.-EMPTY List)))
36183624

36193625
ISequential
36203626
IEquiv
@@ -6528,7 +6534,7 @@ reduces them without incurring seq initialization"
65286534
ICounted
65296535
(-count [coll] count))
65306536

6531-
(set! (.-EMPTY PersistentQueue) (PersistentQueue. nil 0 nil [] empty-ordered-hash))
6537+
(set! (.-EMPTY PersistentQueue) (PersistentQueue. nil 0 nil (.-EMPTY PersistentVector) empty-ordered-hash))
65326538

65336539
(es6-iterable PersistentQueue)
65346540

src/test/cljs/cljs/seqs_test.cljs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
(testing "lazy seq"
4141
(is (seq? e-lazy-seq))
4242
(is (empty? e-lazy-seq))
43-
(is (= {:b :c} (meta e-lazy-seq)))))
43+
;; MAYBE FIXME: this is a bad test, discovered from :lite-mode work
44+
(if-not ^boolean LITE_MODE
45+
(is (= {:b :c} (meta e-lazy-seq)))
46+
;; LITE_MODE has the correct behavior
47+
(is (nil? (meta e-lazy-seq))))))
4448
(let [e-list (empty '^{:b :c} (1 2 3))]
4549
(testing "list"
4650
(is (seq? e-list))

src/test/cljs/lite_test_runner.cljs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
[cljs.clojure-alias-test]
4949
;; [cljs.hash-map-test]
5050
;; [cljs.map-entry-test]
51-
;; [cljs.metadata-test]
51+
[cljs.metadata-test]
5252
[cljs.npm-deps-test]
5353
[cljs.other-functions-test]
5454
[cljs.predicates-test]
@@ -107,7 +107,7 @@
107107
'cljs.specials-test
108108
'cljs.spec.test-test
109109
'cljs.clojure-alias-test
110-
#_'cljs.metadata-test ;; another RSeq one
110+
'cljs.metadata-test
111111
'cljs.npm-deps-test
112112
'cljs.other-functions-test
113113
'cljs.predicates-test

0 commit comments

Comments
 (0)