summaryrefslogtreecommitdiff
path: root/test/core.fnl
diff options
context:
space:
mode:
authorAndrey Orst <andreyorst@gmail.com>2020-11-08 22:02:54 +0300
committerAndrey Orst <andreyorst@gmail.com>2020-11-08 22:02:54 +0300
commit35bcc0ab3ac754e9f2ce6465c3d5c060bd5d37aa (patch)
tree5a8c925c5a3b1ac8a5eab7bb4c516039d0dd09a7 /test/core.fnl
parent910bfcf768c2305a6885b0d1f491561d09ebd9ca (diff)
feature(core): add metadata based type inspection for tables, and empty macro
Diffstat (limited to 'test/core.fnl')
-rw-r--r--test/core.fnl18
1 files changed, 15 insertions, 3 deletions
diff --git a/test/core.fnl b/test/core.fnl
index 557f042..0609788 100644
--- a/test/core.fnl
+++ b/test/core.fnl
@@ -3,7 +3,8 @@
(require-macros :test.test)
(local
- {: apply
+ {: vec
+ : apply
: seq
: first
: rest
@@ -147,13 +148,17 @@
(testing map?
(assert* (map? {:a 1}))
- (assert* (not (map? {}))))
+ (assert* (not (map? {})))
+ (assert* (map? (empty {})))
+ (assert* (not (map? (empty [])))))
(testing seq?
(assert* (not (seq? [])))
(assert* (seq? [{:a 1}]))
(assert* (not (seq? {})))
- (assert* (not (seq? {:a 1}))))
+ (assert* (not (seq? {:a 1})))
+ (assert* (seq? (empty [])))
+ (assert* (not (seq? (empty {})))))
(testing nil?
(assert* (nil?))
@@ -587,3 +592,10 @@
(assert* (not (gt 1 2)))
(assert* (not (gt 2 1 3)))
(assert* (not (gt 1 2 4 4)))))
+
+(deftest vec
+ (testing vec
+ (assert-eq (vec) [])
+ (assert-eq (vec 1) [1])
+ (assert-eq (vec 1 2 3) [1 2 3])
+ (assert-eq (getmetatable (vec 1 2 3)) {:cljlib/table-type :seq})))