Skip to content

Commit ed4e88f

Browse files
authored
Add link to should_panic section in contract testing docs (#847)
<!-- Reference any GitHub issues resolved by this PR --> Closes #778 ## Introduced changes <!-- A brief description of the changes --> - Added link to should_panic section in contract testing docs ## Breaking changes <!-- List of all breaking changes, if applicable --> ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [x] Added relevant tests - [x] Performed self-review of the code - [x] Added changes to `CHANGELOG.md`
1 parent bd93405 commit ed4e88f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/src/testing/contracts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,9 @@ Running 1 test(s) from src/
183183
[PASS] package_name::handling_errors
184184
Tests: 1 passed, 0 failed, 0 skipped
185185
```
186+
187+
### Expecting Test Failure
188+
189+
Sometimes the test code failing can be a desired behavior.
190+
Instead of manually handling it, you can simply mark your test as `#[should_panic(...)]`.
191+
[See here](./testing.md#expected-failures) for more details.

0 commit comments

Comments
 (0)