Skip to content

Commit e8d8599

Browse files
authored
Rollup merge of #100314 - JakobDegen:test-docs, r=RalfJung
Mention `unit-test` in MIR opt test README r? `@RalfJung`
2 parents 790b19f + 6ae1c03 commit e8d8599

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: src/test/mir-opt/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ presence of pointers in constants or other bit width dependent things. In that c
1414

1515
to your test, causing separate files to be generated for 32bit and 64bit systems.
1616

17+
## Unit testing
18+
19+
If you are only testing the behavior of a particular mir-opt pass on some specific input (as is
20+
usually the case), you should add
21+
22+
```
23+
// unit-test: PassName
24+
```
25+
26+
to the top of the file. This makes sure that other passes don't run which means you'll get the input
27+
you expected and your test won't break when other code changes.
28+
1729
## Emit a diff of the mir for a specific optimization
1830

1931
This is what you want most often when you want to see how an optimization changes the MIR.

0 commit comments

Comments
 (0)