-
Notifications
You must be signed in to change notification settings - Fork 5
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
check- vs. assert- #86
Comments
Are you okay with the check-* macros taking the same form as the assert-* macros? i.e., description optional and auto-generated? |
I think that would cause unnecessary code churn. I'd prefer to leave the existing tests as they are, and when touching things gradually move them to assert-* with the new argument order. |
In the case where the "check" semantics are desired, changing them to "assert" won't work. In the case where Giving them the same signature seems important. A possible way around this is to create additional macros: If assertion failures had line numbers associated with them the descriptions would be even less useful. I imagine that's hard though. [edit: fixed formatting] |
I guess my point is that people shouldn't be desiring check-* semantics, and that the value of check-* is not in providing a different semantic, but a compatible one. |
I see, so the plan would be to deprecate the check-* macros. I think that's reasonable. |
I agree that fatal semantics should generally be preferred, but I think there are legitimate uses for non-fatal semantics. The main one being looping over a set of cases. Using fatal semantics means having to build/run/fix n times instead of once (or at least < n). I propose to add new |
Assertion failures now signal <assertion-failure>, which transfers control to an error handler in the test runner. Also did a little cleanup in the tests to use a new with-result-status macro and added 5 missing tests to testworks-test-suite. part of dylan-lang#86
A couple of comments for when I eventually work on this...
|
What is described in the initial comment was done: testworks/tests/testworks-test-suite.dylan Line 484 in 51b577b
I'm implementing the |
These macros don't terminate the test, so in that respect they're similar to the `check-*` macros, but their signatures are like the `assert-*` macros, in which the assertion description is optional and if not supplied is auto-generated from the arguments. See discussion in dylan-lang#86
These macros don't terminate the test, so in that respect they're similar to the `check-*` macros, but their signatures are like the `assert-*` macros, in which the assertion description is optional and if not supplied is auto-generated from the arguments. See discussion in dylan-lang#86
These macros don't terminate the test, so in that respect they're similar to the `check-*` macros, but their signatures are like the `assert-*` macros, in which the assertion description is optional and if not supplied is auto-generated from the arguments. See discussion in dylan-lang#86
These macros don't terminate the test, so in that respect they're similar to the `check-*` macros, but their signatures are like the `assert-*` macros, in which the assertion description is optional and if not supplied is auto-generated from the arguments. See discussion in dylan-lang#86
These macros don't terminate the test, so in that respect they're similar to the `check-*` macros, but their signatures are like the `assert-*` macros, in which the assertion description is optional and if not supplied is auto-generated from the arguments. See discussion in dylan-lang#86
When I was first exposed to the xUnit frameworks (SUnit, jUnit, nUnit, etc., see http://xunitpatterns.com/xUnit.html), I noted that
This is considered best practice for test frameworks nowadays; it eliminates meaningless cascades
of assertion failures, and encourages a no-broken-windows policy more than a
note-failure-and-continue policy would.
by comparison with assert statements and assert macros in various programming languages.
(Not that this is a universal choice; CppUTest uses CHECK_WHATEVER and Google Test
uses EXPECT_WHATEVER.)
testworks
, we could adopt the new abort-test-on-failure semantics for macros named assert-,and keep the existing semantics on the check- macros in existing checks.
Unfortunately I never communicated that observation to anyone. And so, when the current assert-* macros were added in 2013, I considered it a missed opportunity.
However, after five years I still think it would be a good idea. I suggest that we adopt abort-test-unit-on-failure semantics for the assert-* macros, and keep (but discourage) check-* semantics for existing tests.
The text was updated successfully, but these errors were encountered: