diff options
| author | Joel Martin <github@martintribe.org> | 2014-12-18 20:33:49 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-01-09 16:16:50 -0600 |
| commit | b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c (patch) | |
| tree | f4d977ed220e9a3f665cfbf4f68770a81e4c2095 /tests/step9_try.mal | |
| parent | aaba249304b184e12e2445ab22d66df1f39a51a5 (diff) | |
| download | mal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.tar.gz mal-b8ee29b22fbaa7a01f2754b4d6dd9af52e02017c.zip | |
All: add keywords.
Also, fix nth and count to match cloure.
Diffstat (limited to 'tests/step9_try.mal')
| -rw-r--r-- | tests/step9_try.mal | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/step9_try.mal b/tests/step9_try.mal index aee7908..3781e4d 100644 --- a/tests/step9_try.mal +++ b/tests/step9_try.mal @@ -88,6 +88,24 @@ ;; ;; -------- Optional Functionality -------- +;; Testing symbol and keyword functions +(symbol? :abc) +;=>false +(symbol? 'abc) +;=>true +(symbol? "abc") +;=>false +(symbol? (symbol "abc")) +;=>true +(keyword? :abc) +;=>true +(keyword? 'abc) +;=>false +(keyword? "abc") +;=>false +(keyword? (keyword "abc")) +;=>true + ;; Testing sequential? function (sequential? (list 1 2 3)) @@ -110,8 +128,16 @@ (vector 3 4 5) ;=>[3 4 5] +(map? {}) +;=>true +(map? '()) +;=>false (map? []) ;=>false +(map? 'abc) +;=>false +(map? :abc) +;=>false ;; ;; Testing hash-maps @@ -194,6 +220,26 @@ (count (keys hm3)) ;=>2 +;; Testing keywords as hash-map keys +(get {:abc 123} :abc) +;=>123 +(contains? {:abc 123} :abc) +;=>true +(contains? {:abcd 123} :abc) +;=>false +(assoc {} :bcd 234) +;=>{:bcd 234} +(dissoc {:cde 345 :fgh 456} :cde) +;=>{:fgh 456} +(keyword? (nth (keys {:abc 123 :def 456}) 0)) +;=>true +;;; TODO: support : in strings in make impl +;;;(keyword? (nth (keys {":abc" 123 ":def" 456}) 0)) +;;;;=>false +(keyword? (nth (vals {"a" :abc "b" :def}) 0)) +;=>true + + ;; ;; Testing conj function |
