#TheBook
https://doc.rust-lang.org/book/ch11-02-running-tests.html
## メモ
### ポイント
- `cargo test`はデフォルトですべてのテストをスレッドで[[並列]]に実行する
- そのため[[ステートレス]]なテスト設計が必要
- 直列実行したい場合は `cargo test -- --test-threads=1`
- 成功したテストでは[[printlnマクロ]]などで標準出力した結果は表示されない
- 表示したい場合は `cargo test -- --show-output`
### 任意のテストを除外
`#[ignore]`アノテーションをつける。
```rust
#[test]
#[ignore]
fn it_fails() -> Result<(), String> {
// このテストは無視される
Err("faillllllllllllllure!!".into())
}
```
### 任意のテストを実行
- `cargo test <テスト関数名>`で任意の1テストを実行できる
- `cargo test <テスト関数に含まれる文字列>`で任意の複数テストを実行できる
- `cargo test -- --ignored`で`#[ignore]`のついたテストのみを実行できる