Skip to content

Commit

Permalink
Add async fixture test
Browse files Browse the repository at this point in the history
  • Loading branch information
rubdos committed Apr 9, 2020
1 parent 19ff758 commit 7b7e589
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions resources/fixture/async_fixture.rs
@@ -0,0 +1,16 @@
use rstest::*;

#[fixture]
async fn async_u32() -> u32 {
42
}

#[rstest]
async fn default_is_async() {
assert_eq!(42, async_u32::default().await);
}

#[rstest]
async fn use_async_fixture(async_u32: u32) {
assert_eq!(42, async_u32);
}
13 changes: 13 additions & 0 deletions tests/fixture/mod.rs
Expand Up @@ -83,6 +83,19 @@ mod should {
}
}

#[test]
fn resolve_async_fixture() {
let prj = prj("async_fixture.rs");
prj.add_dependency("async-std", r#"{version="*", features=["attributes"]}"#);

let output = prj.run_tests().unwrap();

TestResults::new()
.ok("default_is_async")
.ok("use_async_fixture")
.assert(output);
}

#[test]
fn resolve_fixture_generics_by_fixture_input() {
let (output, _) = run_test("resolve.rs");
Expand Down

0 comments on commit 7b7e589

Please sign in to comment.