Skip to content

Commit

Permalink
Add Windows-specific comments to testing guide
Browse files Browse the repository at this point in the history
Fixes #27936
  • Loading branch information
steveklabnik committed Aug 27, 2015
1 parent ef3255b commit af58e5c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/doc/trpl/testing.md
Expand Up @@ -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`:
Expand Down

0 comments on commit af58e5c

Please sign in to comment.