1 ;;;; lambda-list parsing tests with no side-effects
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
14 (let ((*macroexpand-hook
*
16 (lambda (fun form env
)
17 (handler-bind ((error (lambda (c)
18 (when (eq 'destructuring-bind
(car form
))
19 (throw 'd-b-error c
)))))
20 (funcall fun form env
))))))
21 (macrolet ((maybe-funcall (&rest args
)
22 ;; The evaluator will delay lambda-list checks until
23 ;; the lambda is actually called.
24 (if (eq sb-ext
:*evaluator-mode
* :interpret
)
29 (multiple-value-bind (result error
)
30 (ignore-errors (maybe-funcall (eval `(lambda ,',ll
'ok
))))
31 (unless (and (not result
) error
)
32 (error "No error from lambda ~S." ',ll
)))
35 (eval `(lambda (x) (destructuring-bind ,',ll x
'ok
)))
37 (error "No error from d-b ~S." ',ll
)))))
38 (error-p (&aux
(foo 1) &aux
(bar 2)))
39 (error-p (&aux
(foo 1) &key bar
))
40 (error-p (&aux
(foo 1) &optional bar
))
41 (error-p (&aux
(foo 1) &rest bar
))
42 (error-p (&key foo
&allow-other-keys
&allow-other-keys
))
43 (error-p (&key foo
&key bar
))
44 (error-p (&key foo
&optional bar
))
45 (error-p (&key foo
&rest bar
))
46 (error-p (&optional foo
&optional bar
))
47 (error-p (&rest foo
&rest bar
))
48 (error-p (&rest foo
&optional bar
))))