(import dotted-lambdas) (import simple-tests (chicken base) (chicken condition)) (verbose? #t) (define-tester (calls? lst (callable '(0 1 2 3)) lst0 (callable '())) (condition-case (lst0 0) ((exn) #f)) #f (lst 0) 0 (lst 3) 3 (condition-case (lst 5) ((exn) #f)) #f (lst -1) 4) (define-tester (lambdas?) (use-callables #f) #f ((lambda* (x xs ...) (apply list x xs)) 1 2 3) '(1 2 3) (condition-case ((lambda* (xs ..) xs) 1 2 3) ((exn) #f)) #f (condition-case ((lambda* (xs ....) xs)) ((exn) #f)) #f ((lambda* (xs ...) xs)) '() (condition-case ((lambda* (x y zs ..) (list x y zs)) 1 2 3 4) ((exn) #f)) #f (condition-case ((lambda* (x y zs ....) (list x y zs)) 1 2) ((exn) #f)) #f ((lambda* (a b) (list a b)) 1 2) '(1 2) ((lambda* (as ...) as) 1 2 3) '(1 2 3) ((lambda* (as ...) as)) '() (use-callables #t) #t ((lambda* (xs ...) (list (xs 0) (xs 1) (xs 2))) 1 2 3) '(1 2 3) ((lambda* (x xs ...) (apply list x (xs))) 1 2 3) '(1 2 3) ((lambda* (xs ...) (xs))) '() ((lambda* (x y zs ...) (list x y (zs 0) (zs 1))) 1 2 3 4) '(1 2 3 4) ((lambda* (a b) (list a b)) 1 2) '(1 2) ((lambda* (as ...) (as)) 1 2 3) '(1 2 3) ((lambda* (as ...) (as))) '()) (define* (inc x i ..) (if (use-callables) (+ x (optional (i) 1)) (+ x (optional i 1)))) (define* (foo x y zs ...) (if (use-callables) (list x y (zs)) (list x y zs))) (define* (bar x ys ....) (if (use-callables) (list x (ys)) (list x ys))) (define* (baz xs ..) (if (use-callables) (list (xs)) (list xs))) (define-tester (defines?) (inc 5) 6 (inc 5 3) 8 (foo 1 2 3 4) '(1 2 (3 4)) (foo 1 2) '(1 2 ()) (bar 1 2 3 4) '(1 (2 3 4)) (condition-case (bar 1) ((exn) #f)) #f (baz 1) '((1)) (condition-case (baz 1 2) ((exn) #f)) #f) (test-all DOTTED-LAMBDAS calls? lambdas? defines? )