-
Notifications
You must be signed in to change notification settings - Fork 6
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
A way to include more data in an assertion. #79
Comments
this is an interesting topic... depending on your problem, there are multiple solutions. one way around this for your example would be this one: static foreach(i; 0..100) {
unittest {
...
result.should.equal(expected).because("At iteration %s".format(i));
}
} another way is a |
The issue with that workaround is that each "test" needs to happen serially, as I'm using a test runner that runs tests in parallel. What do you mean by software assertions? |
sorry ... it was a typo :P I was reffering to maybe this is not the best reference, but it is a way of doing it: |
oh... sorry. I think I misunderstood your problem. I think I get it now... |
When you have a test that needs to run multiple times, or simply includes an iteration of some sort, it is often useful to know at which iteration an assertion failed. Currently the only way to include that data with
because
:It would be nice if there was a simple way of including arbitrary data along with an exception, maybe something like this:
Or perhaps a middle-ground would be to allow
because
to be used likeformat
:The text was updated successfully, but these errors were encountered: