From 6d7fd6a7ba06ed2a54293473a0a49d941a364716 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Thu, 13 Oct 2005 06:27:16 +0000 Subject: [PATCH] just an initial test set for keyword args svn: r1061 original commit: 6f4241fe7f0ecee0558cc72be554e260fffb609e --- collects/tests/mzscheme/kw-proc.ss | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 collects/tests/mzscheme/kw-proc.ss diff --git a/collects/tests/mzscheme/kw-proc.ss b/collects/tests/mzscheme/kw-proc.ss new file mode 100644 index 0000000..e053448 --- /dev/null +++ b/collects/tests/mzscheme/kw-proc.ss @@ -0,0 +1,28 @@ + +(load-relative "loadtest.ss") + +(SECTION 'kw-proc) + +(require (lib "kw-proc.ss")) + +;; make sure that lambda/kw behaves as lambda +(test 1 (lambda/kw () 1)) +(test 1 (lambda/kw (x) 1) 0) +(test '() (lambda/kw x x)) +(test '(1 2) (lambda/kw x x) 1 2) +(test '(1 2) (lambda/kw (x . xs) xs) 0 1 2) +;; even with keywords +(test #:x (lambda/kw () #:x)) +(test #:x (lambda/kw (x) #:x) #:y) +(test '(#:x #:y) (lambda/kw x x) #:x #:y) +(test '(#:x #:y) (lambda/kw (x . xs) xs) #:z #:x #:y) + +;; just using #:rest is the same as a dot +(let ([f (lambda/kw (#:rest r) r)]) + (test '() f) + (test '(1) f 1) + (test '(1 2) f 1 2)) +(let ([f (lambda/kw (x #:rest r) r)]) + (test '() f 0) + (test '(1) f 0 1) + (test '(1 2) f 0 1 2))