-
Notifications
You must be signed in to change notification settings - Fork 39
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
Test case macro should not rely on implementation details of the built-in test framework #131
Comments
First of all, thank you for creating this issue. We are not using the built-in use of I don't understand your last example though, what is expected behaviour in it? |
The compilation fails with:
This is because in the |
Okay, so let me give you some background. Test case works by grouping all cases first and then emitting a module with them all. This let's us use rust's built-in test harness and still display a nice hierarchy, with all cases grouped into a parent with test name. Unfortunately we cannot emit multiple modules with the same name:
so this would call for a different solution. Rust, without custom test harness, does not let you to re-define test method "display" after you call So tldr - we are open to suggestions and contributions regarding the topic on how to better structure PS: There's also another option, because with |
It seems the
test_case
attribute can only work as a hack of the built-in test framework rather than an "honest" attribute macro.In particular, this fails:
The built-in use of
test_case
is not documented and should probably be treated as unstable. The built-in attribute certainly is unstable, so overriding it withuse test_case::test_case
is a hack that is liable to stop working in any future release of Rust.Also, this does not work as intended:
This impedes interoperability with another boilerplate-reducing solution for tests: mzabaluev/generic-tests#6
The text was updated successfully, but these errors were encountered: