Skip to content

Commit 28e20ea

Browse files
committed
Append generated test macro so next test macros are aware of it
This way test macros following `#[rstest]` can decide whether or not to generate test macro to avoid duplicate test runs. It is an attempt to improve capabilities among test macros. Currently, following test from [googletest](https://github.com/google/googletest-rust/blob/21f2948684847922a416252b8118e3eada8e29d6/integration_tests/src/google_test_with_rstest.rs#L52-L57)(`main` branch at 2025-01-16) will run twice. ```rust #[rstest] #[case(1)] #[gtest] fn paramterised_test_should_work_with_rstest_first(#[case] value: u32) -> Result<()> { verify_that!(value, eq(value)) } ``` See: tokio-rs/tokio#6497, d-e-s-o/test-log#46, frondeus/test-case#143, kezhuw/stuck#53. Refs: rust-lang/rust#67839, rust-lang/rust#82419.
1 parent 154d0b0 commit 28e20ea

File tree

1 file changed

+1
-1
lines changed
  • rstest_macros/src/render

1 file changed

+1
-1
lines changed

rstest_macros/src/render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ fn single_test_case(
374374
let lifetimes = generics.lifetimes();
375375

376376
quote! {
377-
#test_attr
378377
#(#attrs)*
378+
#test_attr
379379
#asyncness fn #name<#(#lifetimes,)*>(#(#ignored_args,)*) #output {
380380
#test_impl
381381
#inject

0 commit comments

Comments
 (0)