docにテストコードを記載して `cargo test --doc`を実行。
```rust
/// ## Example
/// ```
/// use crate::method;
/// assert_eq!("hoge".to_string(), method());
/// ```
pub fn method() -> String {
"hoge".to_string()
}
```
> [!note]
> `cargo test`でも通常のユニットテストとあわせて実行される
## MOC
- 📚**ドキュメント**
- 📒**関連**
- 📖**ノウハウ**
- [[cargo testでdoctestだけを無視]]
- 💁**トラブルシューティング**
- [[📝Rustのdoctestが遅い]]
- 🗃**用語定義**