mirror of
https://github.com/rust-lang/book.git
synced 2026-05-17 02:40:45 -04:00
26 lines
525 B
Markdown
26 lines
525 B
Markdown
% Testing
|
|
|
|
<small>There is a new edition of the book and this is an old link.</small>
|
|
|
|
> Rust includes support for writing software tests within the language itself.
|
|
|
|
```rust
|
|
#[cfg(test)]
|
|
mod tests {
|
|
#[test]
|
|
fn it_works() {
|
|
}
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
Here are the relevant sections in the new and old books:
|
|
|
|
* **[in the current edition: Ch 11.00 — Testing][2]**
|
|
* <small>[In the first edition: Ch 4.2 — Testing][1]</small>
|
|
|
|
|
|
[1]: https://doc.rust-lang.org/1.30.0/book/first-edition/testing.html
|
|
[2]: ch11-00-testing.html
|