Skip to content

Commit

Permalink
contextualize the non-default config in proptest! macro
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Apr 18, 2023
1 parent 8f50264 commit be301e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions proptest/src/sugar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ macro_rules! proptest {
$(
$(#[$meta])*
fn $test_name() {
let mut config = $config.clone();
let mut config = $crate::test_runner::contextualize_config($config.clone());
config.test_name = Some(
concat!(module_path!(), "::", stringify!($test_name)));
$crate::proptest_helper!(@_BODY config ($($parm in $strategy),+) [] $body);
Expand All @@ -172,7 +172,7 @@ macro_rules! proptest {
$(
$(#[$meta])*
fn $test_name() {
let mut config = $config.clone();
let mut config = $crate::test_runner::contextualize_config($config.clone());
config.test_name = Some(
concat!(module_path!(), "::", stringify!($test_name)));
$crate::proptest_helper!(@_BODY2 config ($($arg)+) [] $body);
Expand Down Expand Up @@ -223,25 +223,25 @@ macro_rules! proptest {
};

($config:expr, |($($parm:pat in $strategy:expr),+ $(,)?)| $body:expr) => { {
let mut config = $config.__sugar_to_owned();
let mut config = $crate::test_runner::contextualize_config($config.__sugar_to_owned());
$crate::sugar::force_no_fork(&mut config);
$crate::proptest_helper!(@_BODY config ($($parm in $strategy),+) [] $body)
} };

($config:expr, move |($($parm:pat in $strategy:expr),+ $(,)?)| $body:expr) => { {
let mut config = $config.__sugar_to_owned();
let mut config = $crate::test_runner::contextualize_config($config.__sugar_to_owned());
$crate::sugar::force_no_fork(&mut config);
$crate::proptest_helper!(@_BODY config ($($parm in $strategy),+) [move] $body)
} };

($config:expr, |($($arg:tt)+)| $body:expr) => { {
let mut config = $config.__sugar_to_owned();
let mut config = $crate::test_runner::contextualize_config($config.__sugar_to_owned());
$crate::sugar::force_no_fork(&mut config);
$crate::proptest_helper!(@_BODY2 config ($($arg)+) [] $body);
} };

($config:expr, move |($($arg:tt)+)| $body:expr) => { {
let mut config = $config.__sugar_to_owned();
let mut config = $crate::test_runner::contextualize_config($config.__sugar_to_owned());
$crate::sugar::force_no_fork(&mut config);
$crate::proptest_helper!(@_BODY2 config ($($arg)+) [move] $body);
} };
Expand Down

0 comments on commit be301e6

Please sign in to comment.