From 3f137ed0b1871680139ee3909d280eaa6a95a876 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Fri, 24 May 2019 17:53:24 -0400 Subject: [PATCH] Add keyword argument tests --- test/suite6.janet | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/suite6.janet b/test/suite6.janet index 1b34b3c6..c5c5326f 100644 --- a/test/suite6.janet +++ b/test/suite6.janet @@ -96,4 +96,11 @@ (setdyn :a 100) (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)