commit 97f3cefb6366c4d8b7593761e1076d3e862198ec parent 5ab8b66e2b00439127e7bd2c142eeed55c92b598 Author: AlexKnauth <alexander@knauth.org> Date: Tue, 17 May 2016 22:50:11 -0400 add keyword-lambda arity tests Diffstat:
| M | kw-utils/keyword-lambda.rkt | | | 18 | +++++++++++++++++- |
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/kw-utils/keyword-lambda.rkt b/kw-utils/keyword-lambda.rkt @@ -46,4 +46,20 @@ (check-equal? (proc #:a 'a #:b 'b 0 1 2) (list '(#:a #:b) '(a b) '(0 1 2))) (check-equal? (object-name proc) 'proc) - )) + ) + (local [(define proc0 + (keyword-lambda (kws kw-args) + (list kws kw-args))) + (define proc1 + (keyword-lambda (kws kw-args x) + (list kws kw-args x)))] + (check-equal? (proc0 #:a 'a #:b 'b) + (list '(#:a #:b) '(a b))) + (check-equal? (proc1 #:a 'a 'x #:b 'b) + (list '(#:a #:b) '(a b) 'x)) + (check-equal? (object-name proc0) 'proc0) + (check-equal? (object-name proc1) 'proc1) + (check-equal? (procedure-arity proc0) 0) + (check-equal? (procedure-arity proc1) 1) + ) + )