1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00

Merge pull request #376 from bjh21/bjh21-withmeta-empty

step A: Test that metadata doesn't break empty collections.
This commit is contained in:
Joel Martin 2019-05-14 17:25:35 -07:00 committed by GitHub
commit bf5cba817e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,18 +226,30 @@
(meta (with-meta [1 2 3] "abc"))
;=>"abc"
(with-meta [] "abc")
;=>[]
(meta (with-meta (list 1 2 3) {"a" 1}))
;=>{"a" 1}
(list? (with-meta (list 1 2 3) {"a" 1}))
;=>true
(with-meta (list) {"a" 1})
;=>()
(empty? (with-meta (list) {"a" 1}))
;=>true
(meta (with-meta {"abc" 123} {"a" 1}))
;=>{"a" 1}
(map? (with-meta {"abc" 123} {"a" 1}))
;=>true
(with-meta {} {"a" 1})
;=>{}
;;; Not actually supported by Clojure
;;;(meta (with-meta (atom 7) {"a" 1}))
;;;;=>{"a" 1}