summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrey Orst <andreyorst@gmail.com>2020-11-21 19:53:29 +0300
committerAndrey Orst <andreyorst@gmail.com>2020-11-21 19:53:29 +0300
commit644fedfa61ad2372cc3b99e0ba18962433340a42 (patch)
treed32b990d97df3ad7791db6a9499cfd9e624378ed /tests
parent48f1ed65cf81803e6c5867b2bea18df1638718f8 (diff)
feature(core): more hash table functions
Diffstat (limited to 'tests')
-rw-r--r--tests/core.fnl20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/core.fnl b/tests/core.fnl
index 1921a05..d323a07 100644
--- a/tests/core.fnl
+++ b/tests/core.fnl
@@ -423,7 +423,25 @@
(assert-not (pcall assoc))
(assert-not (pcall assoc {}))
(assert-eq (assoc {} :a 1) {:a 1})
- (assert-eq (assoc {} :a 1 :b 2 :c 3 :d 4) {:a 1 :b 2 :c 3 :d 4})))
+ (assert-eq (assoc {} :a 1 :b 2 :c 3 :d 4) {:a 1 :b 2 :c 3 :d 4}))
+
+ (testing "dissoc"
+ (assert-not (pcall dissoc))
+ (assert-eq (dissoc {}) {})
+ (assert-eq (dissoc {:a 1 :b 2} :b) {:a 1})
+ (assert-eq (dissoc {:a 1 :b 2 :c 3} :a :c) {:b 2}))
+
+ (testing "find, keys and vals"
+ (assert-not (pcall keys))
+ (assert-not (pcall keys {} {} {}))
+ (assert-not (pcall vals))
+ (assert-not (pcall vals {} {} {}))
+ (assert-not (pcall find))
+ (assert-not (pcall find {} {} {}))
+ (assert-eq (keys {:a 1 :b 2 :c 3}) (hash-set :a :b :c))
+ (assert-eq (vals {:a 1 :b 2 :c 3}) (hash-set 1 2 3))
+ (assert-eq (find {:a 1 :b 2 :c 3} :c) [:c 3])
+ (assert-eq (find {:a 1 :b 2 :c 3} :d) nil)))
(deftest function-manipulation
(testing "constantly"