]> git.lizzy.rs Git - rust.git/commitdiff
Add Windows-specific comments to testing guide
authorSteve Klabnik <steve@steveklabnik.com>
Wed, 26 Aug 2015 18:02:38 +0000 (14:02 -0400)
committerSteve Klabnik <steve@steveklabnik.com>
Thu, 27 Aug 2015 17:43:43 +0000 (13:43 -0400)
Fixes #27936

src/doc/trpl/testing.md

index 78803afd5c1ad030ad9ca847f5693576d808d9da..587f60343c344ade265760671c737a344bcd5a33 100644 (file)
@@ -120,13 +120,26 @@ And that's reflected in the summary line:
 test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
 ```
 
-We also get a non-zero status code:
+We also get a non-zero status code. We can use `$?` on OS X and Linux:
 
 ```bash
 $ echo $?
 101
 ```
 
+On Windows, if you’re using `cmd`:
+
+```bash
+> echo %ERRORLEVEL%
+```
+
+And if you’re using PowerShell:
+
+```bash
+> echo $LASTEXITCODE # the code itself
+> echo $? # a boolean, fail or succeed
+```
+
 This is useful if you want to integrate `cargo test` into other tooling.
 
 We can invert our test's failure with another attribute: `should_panic`: