Skip to content

Metadata on lazy seqs #921

Description

@borkdude

Treat this test as pseudo-code of what I wanted to report, it's from squint:

(deftest with-meta-on-lazy-seq-test
  (testing "with-meta on a lazy seq carries metadata"
    (is (eq {:x 1} (jsv! '(meta (with-meta (range 3) {:x 1})))))
    (is (eq {:x 1} (jsv! '(meta (with-meta (concat [1] [2]) {:x 1})))))
    (is (eq {:x 1} (jsv! '(meta (with-meta (lazy-seq [1 2 3]) {:x 1}))))))
  (testing "does not realize or alias the original"
    (is (eq [nil false [1 2 3]]
            (jsv! '(let [a (lazy-seq [1 2 3])
                         b (with-meta a {:x 1})]
                     [(meta a) (realized? b) (vec b)]))))))

I'm actively working on getting squint to work with this test suite now, but there wasn't a test for this one yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions