Skip to content
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

unit test macros #3400

Closed
jesse99 opened this issue Sep 6, 2012 · 5 comments
Closed

unit test macros #3400

jesse99 opened this issue Sep 6, 2012 · 5 comments
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@jesse99
Copy link
Contributor

jesse99 commented Sep 6, 2012

Using asserts within unit tests is entirely unsatisfactory: when they fail you can't see why without editing the code or breaking out a debugger, and it's difficult to be intelligent about pointing out where the problem is (e.g. maybe the second element of a vector doesn't match the expected value).

Seems like it would be possible to use the new whiz bang macro system to address this. Lots of unit test frameworks out there, but it's probably best to look at one for a statically typed language like Nunit.

@jesse99
Copy link
Contributor Author

jesse99 commented Sep 8, 2012

Blocked by #3066 (line! reports line numbers within the macro).

@catamorphism
Copy link
Contributor

#3066 is still open, so this is still blocked.

@graydon
Copy link
Contributor

graydon commented Jul 11, 2013

we have assert_eq and such now. I think the minor issues in #3066 aren't blocking this, and in any case appear to have been fixed by #4888 . Can we close this?

@pnkfelix
Copy link
Member

I agree with Graydon that #3066 appears to be fixed. I'm going to double check that our existing unit test patterns produces useful error messages.

@pnkfelix
Copy link
Member

Okay, we do indeed get useful stack traces from assertion failures, in particular assert_eq prints out the two values separately.

I don't think we need to adopt a more full-featured test infrastructure without some different motivating examples. (we might consider refining the assert_eq output to narrow in on the relevant bit of substructure that does not match, but that is not this ticket.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

4 participants