racket / rackunit

Other
18 stars 34 forks source link

Support keyword, rest, and default arguments in custom checks #17

Open jackfirth opened 8 years ago

jackfirth commented 8 years ago

define-check and define-simple-check only allow positional arguments without defaults to be provided. If checks are meant to be semantically procedures, they should accept the same arguments as procedures.

rmculpepper commented 8 years ago

Rest args would be problematic, because define-check adds an extra optional positional argument message. So (define-check (f x y) ....) defines f as a "procedure" of 2 or 3 arguments.

We could add a check definition form that didn't do that, though.

jackfirth commented 8 years ago

Never knew that, the docs ought to mention it. I don't find it too useful though because with custom checks I'm always constructing the error message within the check, but this param just adds something to the info stack. Is that behavior used?