Skip to content

Commit ab3dc54

Browse files
committed
Rollup merge of rust-lang#28022 - steveklabnik:gh27936, r=alexcrichton
Fixes rust-lang#27936
2 parents 71ecc42 + af58e5c commit ab3dc54

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/doc/trpl/testing.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,26 @@ And that's reflected in the summary line:
120120
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
121121
```
122122

123-
We also get a non-zero status code:
123+
We also get a non-zero status code. We can use `$?` on OS X and Linux:
124124

125125
```bash
126126
$ echo $?
127127
101
128128
```
129129

130+
On Windows, if you’re using `cmd`:
131+
132+
```bash
133+
> echo %ERRORLEVEL%
134+
```
135+
136+
And if you’re using PowerShell:
137+
138+
```bash
139+
> echo $LASTEXITCODE # the code itself
140+
> echo $? # a boolean, fail or succeed
141+
```
142+
130143
This is useful if you want to integrate `cargo test` into other tooling.
131144

132145
We can invert our test's failure with another attribute: `should_panic`:

0 commit comments

Comments
 (0)