-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add test_matrix macro #128
Conversation
I've just discovered that there is no way to fork a GitHub Wiki. Seriously, GitHub!? 👹 So, if you decide to merge this PR, I can send you updated Wiki Markdown files at that time. I've cloned the wiki into my forked repo, so you can see my proposed changes... just not in the nice PR interface. 🤷 |
Thanks for contributing :) I think I like the approach. I'll look into this over the weekend. If I didn't answer by Monday, feel free to ping me. |
ff85934
to
c2cc308
Compare
Allows generating Cartesian product test matrices. Tests and docs forthcoming.
c2cc308
to
6b0bc0c
Compare
Proposed Wiki changes are previewable at https://github.com/overhacked/test-case/wiki. Diff at https://github.com/overhacked/test-case/wiki/_compare/11bdf1109e08b9d1c54ab30ef3eff7254a5059ac...ed4b3c49a6b1072b9ffab3822e1d8a3d53cffcde. |
@luke-biel, if you have a second to approve running the CI workflow before Monday, I've got time over the weekend to troubleshoot any possible CI issues. |
Approved :) |
I definitely like what I see, however it might be a good idea to have this feature behind a flag. What I noticed at first glance, is that we add What do you think? |
Test basic features and for correct compilation error output
Required that `TestCaseExpression` and all it's descendant structs be `Clone` so that TestMatrix can clone them for each TestCase it creates. Also made TestComment Clone for parity. Implemented quote::ToTokens for TestComment so that the "illegal comment" error generated by TestMatrix can point to the correct span of where the illegal comment begins. On stable Rust, this just highlights the first token, the semicolon, but on nightly Rust (which has `quote::Span::join`) it will highlight the entire illegal comment.
`isize` will allow for negative numbers and be compatible with 32-bit and 64-bit platforms. Add some acceptance tests for the same.
Add unreleased CHANGELOG fragment, README documentation, and doc comment to src/lib.rs and crate/test-case-macros/src/lib.rs. Detailed Wiki documentation forthcoming.
6b0bc0c
to
99f0c11
Compare
Fixed the CI issues. I didn't understand the nightly/stable Also, the last commit in the series is a crazy idea that I'm not even sure I'm 💯 on board with. The Happy to discuss. Totally fine if you're not at all on board with it. |
Copied multi_product module from itertools 0.11.0 under MIT license. Eliminates dependency on building all of itertools.
99f0c11
to
19ba7c4
Compare
Finally had time to tackle this. Code looked good, didn't need to contact you. The itertools mod copy-paste was something I was considering suggesting earlier, so I'm happy it was done :) |
The
test_matrix
macro generates test cases from the Cartesian product of possible values given for test function arguments. For each argument, it supports lists of possible values, numeric ranges, or single expressions (for constant arguments). It also supports the=>
syntax for asserting test case output, which is handled identically totest_case
, because the parsedTestCaseExpression
is cloned and included in each generatedTestCase
before it is rendered.Acceptance tests and basic documentation are included in this PR. I'd like to also update the Wiki documentation, and will open a parallel PR to the wiki repo.
Usage example
Related Issues