diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-10 00:00:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-10 00:00:35 +0200 |
| commit | e8d8599ad95ef664b4c53a05153e18910d149328 (patch) | |
| tree | a2babcb491c46a6c95e45ca7715d360aa2be3c08 | |
| parent | 790b19f514f56f71b4b2ddb77981f319885717dd (diff) | |
| parent | 6ae1c0327af64d12e5b0d675c3c7e61343ef0319 (diff) | |
| download | rust-e8d8599ad95ef664b4c53a05153e18910d149328.tar.gz rust-e8d8599ad95ef664b4c53a05153e18910d149328.zip | |
Rollup merge of #100314 - JakobDegen:test-docs, r=RalfJung
Mention `unit-test` in MIR opt test README r? `@RalfJung`
| -rw-r--r-- | src/test/mir-opt/README.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/mir-opt/README.md b/src/test/mir-opt/README.md index a0550466cf0..0721d9f7019 100644 --- a/src/test/mir-opt/README.md +++ b/src/test/mir-opt/README.md @@ -14,6 +14,18 @@ presence of pointers in constants or other bit width dependent things. In that c to your test, causing separate files to be generated for 32bit and 64bit systems. +## Unit testing + +If you are only testing the behavior of a particular mir-opt pass on some specific input (as is +usually the case), you should add + +``` +// unit-test: PassName +``` + +to the top of the file. This makes sure that other passes don't run which means you'll get the input +you expected and your test won't break when other code changes. + ## Emit a diff of the mir for a specific optimization This is what you want most often when you want to see how an optimization changes the MIR. |
