summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core.fnl18
-rw-r--r--test/macros.fnl7
2 files changed, 22 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})))
diff --git a/test/macros.fnl b/test/macros.fnl
index 638a29d..53de853 100644
--- a/test/macros.fnl
+++ b/test/macros.fnl
@@ -135,3 +135,10 @@
(assert-eq (meta x) (when-meta {:fnl/docstring "x"}))
(defonce {:doc "y" :dynamic true} y 20)
(assert-eq (meta y) (when-meta {:fnl/docstring "y"}))))
+
+(deftest empty
+ (testing empty
+ (assert-eq (empty {}) {})
+ (assert-eq (empty []) {})
+ (assert-eq (getmetatable (empty [])) {:cljlib/table-type :seq})
+ (assert-eq (getmetatable (empty {})) {:cljlib/table-type :table})))