Skip to content

Commit

Permalink
update docs, simplified unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcobacis committed Jul 21, 2024
1 parent a2b902e commit cf9dd0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 4 additions & 0 deletions rstest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,10 @@ pub use rstest_macros::fixture;
/// in this case the `#[actix_rt::test]` attribute will replace the standard `#[test]`
/// attribute.
///
/// Some test attributes allow to inject arguments into the test function, in a similar way to rstest.
/// This can lead to compile errors when rstest is not able to resolve the additional arguments.
/// To avoid this, see [Ignoring Arguments](attr.rstest.html#ignoring-arguments).
///
/// ## Local lifetime and `#[by_ref]` attribute
///
/// In some cases you may want to use a local lifetime for some arguments of your test.
Expand Down
9 changes: 4 additions & 5 deletions rstest_macros/src/parse/ignore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ mod should {
assert_eq!(by_refs, to_idents!(expected_refs));
}

#[rstest]
#[case::no_more_than_one("fn f(#[ignore] #[ignore] a: u32) {}", "more than once")]
fn raise_error(#[case] item_fn: &str, #[case] message: &str) {
let mut item_fn: ItemFn = item_fn.ast();
#[test]
fn raise_error() {
let mut item_fn: ItemFn = "fn f(#[ignore] #[ignore] a: u32) {}".ast();

let err = extract_ignores(&mut item_fn).unwrap_err();

assert_in!(format!("{:?}", err), message);
assert_in!(format!("{:?}", err), "more than once");
}
}

0 comments on commit cf9dd0b

Please sign in to comment.