@@ -7,13 +7,13 @@ The test format is:
7
7
// END RUST SOURCE
8
8
// START $file_name_of_some_mir_dump_0
9
9
// $expected_line_0
10
- // ...
10
+ // (lines or elision)
11
11
// $expected_line_N
12
12
// END $file_name_of_some_mir_dump_0
13
- // ...
13
+ // (lines or elision)
14
14
// START $file_name_of_some_mir_dump_N
15
15
// $expected_line_0
16
- // ...
16
+ // (lines or elision)
17
17
// $expected_line_N
18
18
// END $file_name_of_some_mir_dump_N
19
19
```
@@ -22,10 +22,15 @@ All the test information is in comments so the test is runnable.
22
22
23
23
For each $file_name, compiletest expects [ $expected_line_0, ...,
24
24
$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.
29
34
30
35
```
31
36
bb0: {
35
40
}
36
41
```
37
42
38
- that will inadvertantly pattern-matching against:
39
-
40
43
```
41
44
bb0: {
42
45
StorageLive(_1);
@@ -49,6 +52,18 @@ bb1: {
49
52
}
50
53
```
51
54
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
+
52
67
Lines match ignoring whitespace, and the prefix "//" is removed.
53
68
54
69
It also currently strips trailing comments -- partly because the full file path
0 commit comments