1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-23 23:10:26 +00:00

Add keyword argument tests

This commit is contained in:
Calvin Rose 2019-05-24 17:53:24 -04:00
parent 5deb13d73e
commit 3f137ed0b1

View File

@ -96,4 +96,11 @@
(setdyn :a 100) (setdyn :a 100)
(assert (= 100 (dyn :a)) "dyn usage 4") (assert (= 100 (dyn :a)) "dyn usage 4")
# Keyword arguments
(defn myfn [x y z &keys {:a a :b b :c c}]
(+ x y z a b c))
(assert (= (+ ;(range 6)) (myfn 0 1 2 :a 3 :b 4 :c 5)) "keyword args 1")
(assert (= (+ ;(range 6)) (myfn 0 1 2 :a 1 :b 6 :c 5 :d 11)) "keyword args 2")
(end-suite) (end-suite)