@@ -7,13 +7,13 @@ The test format is:
77// END RUST SOURCE
88// START $file_name_of_some_mir_dump_0
99// $expected_line_0
10- // ...
10+ // (lines or elision)
1111// $expected_line_N
1212// END $file_name_of_some_mir_dump_0
13- // ...
13+ // (lines or elision)
1414// START $file_name_of_some_mir_dump_N
1515// $expected_line_0
16- // ...
16+ // (lines or elision)
1717// $expected_line_N
1818// END $file_name_of_some_mir_dump_N
1919```
@@ -22,10 +22,15 @@ All the test information is in comments so the test is runnable.
2222
2323For each $file_name, compiletest expects [ $expected_line_0, ...,
2424$expected_line_N] to appear in the dumped MIR in order. Currently it allows
25- other non-matched lines before, after and in-between. Note that this includes
26- lines that end basic blocks or begin new ones; it is good practice
27- in your tests to include the terminator for each of your basic blocks as an
28- internal sanity check guarding against a test like:
25+ other non-matched lines before and after, but not between $expected_lines,
26+ should you want to skip lines, you must include an elision comment, of the form
27+ (as a regex) ` //\s*...\s* ` . The lines will be skipped lazily, that is, if there
28+ are two identical lines in the output that match the line after the elision
29+ comment, the first one wil be matched.
30+
31+ Examples:
32+
33+ The following blocks will not match the one after it.
2934
3035```
3136bb0: {
3540}
3641```
3742
38- that will inadvertantly pattern-matching against:
39-
4043```
4144bb0: {
4245 StorageLive(_1);
@@ -49,6 +52,18 @@ bb1: {
4952}
5053```
5154
55+ But this will match the one above,
56+
57+ ```
58+ bb0: {
59+ StorageLive(_1);
60+ _1 = const true;
61+ ...
62+ StorageDead(_1);
63+ ...
64+ }
65+ ```
66+
5267Lines match ignoring whitespace, and the prefix "//" is removed.
5368
5469It also currently strips trailing comments -- partly because the full file path
0 commit comments