just an initial test set for keyword args

svn: r1061
This commit is contained in:
Eli Barzilay 2005-10-13 06:27:16 +00:00
parent 3bded648f7
commit 6f4241fe7f
2 changed files with 30 additions and 0 deletions

View File

@ -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))

View File

@ -40,6 +40,8 @@
(load-relative "match-test.ss")
(load-relative "kw-proc.ss")
; Next-to-last, because it `require's mzscheme
(load-relative "shared.ss")