You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_`
Copy file name to clipboardExpand all lines: tests/footnotes.rs
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ extern crate pulldown_cmark;
5
5
6
6
7
7
#[test]
8
-
fnspec_test_1(){
8
+
fnfootnotes_test_1_(){
9
9
let original = r##"Lorem ipsum.[^a]
10
10
11
11
[^a]: Cool.
@@ -31,7 +31,7 @@ extern crate pulldown_cmark;
31
31
}
32
32
33
33
#[test]
34
-
fnspec_test_2(){
34
+
fnfootnotes_test_2_(){
35
35
let original = r##"> This is the song that never ends.\
36
36
> Yes it goes on and on my friends.[^lambchops]
37
37
>
@@ -61,7 +61,7 @@ Yes it goes on and on my friends.<sup class="footnote-reference"><a href="#lambc
61
61
}
62
62
63
63
#[test]
64
-
fnspec_test_3(){
64
+
fnfootnotes_test_3_(){
65
65
let original = r##"Songs that simply loop are a popular way to annoy people. [^examples]
66
66
67
67
[^examples]:
@@ -94,7 +94,7 @@ Yes it goes on and on my friends.<sup class="footnote-reference"><a href="#lambc
94
94
}
95
95
96
96
#[test]
97
-
fnspec_test_4(){
97
+
fnfootnotes_test_4_(){
98
98
let original = r##"[^lorem]: If heaven ever wishes to grant me a boon, it will be a total effacing of the results of a mere chance which fixed my eye on a certain stray piece of shelf-paper. It was nothing on which I would naturally have stumbled in the course of my daily round, for it was an old number of an Australian journal, the Sydney Bulletin for April 18, 1925. It had escaped even the cutting bureau which had at the time of its issuance been avidly collecting material for my uncle's research.
99
99
100
100
I had largely given over my inquiries into what Professor Angell called the "Cthulhu Cult", and was visiting a learned friend in Paterson, New Jersey; the curator of a local museum and a mineralogist of note. Examining one day the reserve specimens roughly set on the storage shelves in a rear room of the museum, my eye was caught by an odd picture in one of the old papers spread beneath the stones. It was the Sydney Bulletin I have mentioned, for my friend had wide affiliations in all conceivable foreign parts; and the picture was a half-tone cut of a hideous stone image almost identical with that which Legrasse had found in the swamp.
@@ -120,7 +120,7 @@ I had largely given over my inquiries into what Professor Angell called the "Cth
120
120
}
121
121
122
122
#[test]
123
-
fnspec_test_5(){
123
+
fnfootnotes_test_5_(){
124
124
let original = r##"[^ipsum]: How much wood would a woodchuck chuck.
125
125
126
126
If a woodchuck could chuck wood.
@@ -150,7 +150,7 @@ If a woodchuck could chuck wood.
150
150
}
151
151
152
152
#[test]
153
-
fnspec_test_6(){
153
+
fnfootnotes_test_6_(){
154
154
let original = r##"> He's also really stupid. [^why]
155
155
>
156
156
> [^why]: Because your mamma!
@@ -181,7 +181,7 @@ As such, we can guarantee that the non-childish forms of entertainment are proba
181
181
}
182
182
183
183
#[test]
184
-
fnspec_test_7(){
184
+
fnfootnotes_test_7_(){
185
185
let original = r##"Nested footnotes are considered poor style. [^a] [^xkcd]
186
186
187
187
[^a]: This does not mean that footnotes cannot reference each other. [^b]
@@ -226,7 +226,7 @@ As such, we can guarantee that the non-childish forms of entertainment are proba
226
226
}
227
227
228
228
#[test]
229
-
fnspec_test_8(){
229
+
fnfootnotes_test_8_(){
230
230
let original = r##"[^Doh] Ray Me Fa So La Te Do! [^1]
231
231
232
232
[^Doh]: I know. Wrong Doe. And it won't render right.
0 commit comments