Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make generated cargo tests easier to work with
While the main executable can also run tests, keeping the standard `cargo test` function useful is also helpful. * Add end character to generated tests to work with substring only matching of tests cases. Regex test matching was removed in early 2015 in: rust-lang/rust#21458 You can only filter tests by substring. What if you wanted to run `spec_test_6`? You would run `spec_test_64` too. Adding the character, `_` to the end allows a workaround of specifying `spec_test_6_` as the match to run if you wanted to only run `spec_test_6_`. E.g. `cargo test spec_test_6_` * Tests are modified to generate tests with spec names in the tests Previously, all tests were generated with `spec_test_#_` as their name, even if they were not generated from `spec.txt`. The `tables.txt` spec would also generate a `spec_test_#_`. This is an issue if you wanted to test `spec_test_6_` and only wanted to run the one from `spec.txt` and not `tables.txt`'s `spec_test_6_`'. While you could build the test executables and only run the specific test executable with the `spec_test_#_` you want, it's kind of annoying. This change derives the test names from the spec filename. For example, `spec.txt` will generate `spec_test_6_` while `tables.txt` and `footnotes.txt` will generate `tables_test_6_` and `footnotes_test_6_` respectively. Future optional specifications that might be added will utilize the same rule. This allows testing of example 6 from the `footnotes.txt` spec by simply doing: `cargo test footnotes_test_6_`
- Loading branch information