-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test report macro with tokio and async-std
- Loading branch information
1 parent
752e2f7
commit c74192b
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#![cfg(test)] | ||
|
||
mod location; | ||
mod report; | ||
|
||
mod api { | ||
use futures::{stream, StreamExt, TryStream}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use snafu::{prelude::*, Report}; | ||
|
||
#[derive(Debug, Snafu)] | ||
struct Error; | ||
|
||
#[test] | ||
fn tokio_main_attribute_first() { | ||
#[tokio::main(flavor = "current_thread")] | ||
#[snafu::report] | ||
async fn mainlike() -> Result<(), Error> { | ||
Snafu.fail() | ||
} | ||
|
||
let _: Report<_> = mainlike(); | ||
} | ||
|
||
#[test] | ||
fn tokio_main_attribute_last() { | ||
#[snafu::report] | ||
#[tokio::main(flavor = "current_thread")] | ||
async fn mainlike() -> Result<(), Error> { | ||
Snafu.fail() | ||
} | ||
|
||
let _: Report<_> = mainlike(); | ||
} | ||
|
||
#[tokio::test] | ||
#[snafu::report] | ||
async fn tokio_test_attribute_first() -> Result<(), Error> { | ||
Ok(()) | ||
} | ||
|
||
#[snafu::report] | ||
#[tokio::test] | ||
async fn tokio_test_attribute_last() -> Result<(), Error> { | ||
Ok(()) | ||
} | ||
|
||
#[test] | ||
fn async_std_main_attribute_last() { | ||
#[derive(Debug, Snafu)] | ||
struct Error; | ||
|
||
#[snafu::report] | ||
#[async_std::main] | ||
async fn main() -> Result<(), Error> { | ||
Snafu.fail() | ||
} | ||
|
||
let _: Report<_> = main(); | ||
} | ||
|
||
#[snafu::report] | ||
#[async_std::test] | ||
async fn async_std_test_attribute_last() -> Result<(), Error> { | ||
Ok(()) | ||
} |