diff options
Diffstat (limited to 'core_test.fnl')
| -rw-r--r-- | core_test.fnl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/core_test.fnl b/core_test.fnl index d607935..c618e9e 100644 --- a/core_test.fnl +++ b/core_test.fnl @@ -433,13 +433,18 @@ (assert-eq (get {:key1 10 :key2 20} :key1) 10) (assert-eq (get {:key1 10 :key2 20} :key1 false) 10) (assert-eq (get {:key1 10 :key2 20} :key3 false) false) - (assert-eq (get {:key1 10 :key2 20} :key3) nil)) + (assert-eq (get {:key1 10 :key2 20} :key3) nil) + (assert* (not (pcall get))) + (assert* (not (pcall get {})))) - (testing get + (testing get-in (local t {:a {:b {:c 10}}}) - (assert-eq (get t [:a]) {:b {:c 10}}) - (assert-eq (get t [:a :b]) {:c 10}) - (assert-eq (get t [:a :b :c]) 10) - (assert-eq (get t [:a :b :c] false) 10) - (assert-eq (get t [:a :b :d] false) false) - (assert-eq (get t [:a :b :d]) nil))) + (assert-eq (get-in t [:a]) {:b {:c 10}}) + (assert-eq (get-in t [:a :b]) {:c 10}) + (assert-eq (get-in t [:a :b :c]) 10) + (assert-eq (get-in t [:a :b :c] false) 10) + (assert-eq (get-in t [:a :b :d] false) false) + (assert-eq (get-in t [:a :b :d]) nil) + (assert-eq (get-in t []) t) + (assert* (not (pcall get-in))) + (assert* (not (pcall get-in {}))))) |