Skip to content

Commit

Permalink
Update style.md with actual examples of mz_ore::test
Browse files Browse the repository at this point in the history
  • Loading branch information
def- committed Jun 1, 2023
1 parent c2452dc commit 4e30fa0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions doc/developer/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,30 @@ Use the `mz_ore::test` macro instead of `test`, since it automatically
initializes logging. For tokio tests you can use
`#[mz_ore::test(tokio::test)]`.

Before:
```rust
#[test]
fn test_auth_base() {
mz_ore::test::init_logging();
// Test body here
}
```

After:
```rust
#[mz_ore::test]
fn test_auth_base() {
// Test body here
}
```

For tokio tests with parameters:
```rust
#[mz_ore::test(tokio::test(flavor = "multi_thread"))]
async fn state_cache_concurrency() {
// Test body here
}
```

[Clippy]: https://github.com/rust-lang/rust-clippy
[rustfmt]: https://github.com/rust-lang/rustfmt
Expand Down

0 comments on commit 4e30fa0

Please sign in to comment.