-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposed meta-check API #47
Comments
Why not just one
|
It seems awkward for cases where I just want to assert that a check fails and don't want to do anything with infos or the failure message. What about if the It's cumbersome to assert a particular info is added with a predicate, so I'd still like something like |
I'd still prefer just having Maybe (3) is not such a big deal? Suppose you added (I've never actually written a |
(Re: symmetry with (1) A check-info value is shorter and makes less noise than a predicate. It's more readable in the source code. (2) A check-info value is transparent and can be incredibly useful to see in the failure message. A predicate can specify arbitrary things, but it doesn't give any useful information beyond |
Just a suggestion: the |
Proposal v2
Note that |
What about (For this to work, |
I dislike that the same check can do so many different things depending on the type of argument, but it's weird to have the I don't think I understand what you mean about |
I'm the one who didn't understand --- I thought it'd be okay to write Do what you think is best about |
As mentioned in #14, it's very difficult to test custom RackUnit checks. This issue proposes some additional checks for RackUnit to improve the situation
The checks
(check-fail (lambda () (check-equal? 1 2)))
- asserts that the given thunk raises a single check failure(check-fail/info (make-actual-info 1) (lambda () (check-equal? 1 2)))
- asserts that the given thunk raises a single check failure containing the given check info(check-fail/message #rx"foo" (lambda () (check-equal? 1 2)))
- asserts that the given thunk raises a single check failure whosefail-check
message matches the given regexp (a predicate could also be provided, to match the behavior ofcheck-exn
)These checks would need to ensure the checks to be tested don't increment the test failure counter, as well as ensuring they don't print their typical output. This will likely require some modification of
define-check
to allow selectively disabling the test failure counter.Alternatives considered
check-fail
for asserting the info and message. This might be nicer to read, but then one check expression is asserting multiple things. This conflicts with the typical philosophy of "one check = one assertion". Plus, keyword arguments aren't currently supported in custom checks (see Support keyword, rest, and default arguments in custom checks #17).check-exn
take thunks, anddefine-check
doesn't allow delaying evaluation.check-pass
form. There's no point; just use the check directly.The text was updated successfully, but these errors were encountered: