summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/README.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:31 +0000
commit2ff14448863ac1a1dd9533461708e29aae170c2d (patch)
tree85b9fea2bbfe3f06473cfa381eed11f273b57c5c /src/test/mir-opt/README.md
parentAdding debian version 1.64.0+dfsg1-1. (diff)
downloadrustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz
rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/mir-opt/README.md')
-rw-r--r--src/test/mir-opt/README.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/mir-opt/README.md b/src/test/mir-opt/README.md
index a0550466c..0721d9f70 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.