frozenlib / test-strategy

Procedural macro to easily write higher-order strategies in proptest.
Apache License 2.0
44 stars 10 forks source link

Mutable function arguments when using the 'strategy' attribute. #2

Closed lemmih closed 3 years ago

lemmih commented 3 years ago

Hi,

This code doesn't work because #[strategy(..)] apparently strips the mut keyword.

#[proptest]
fn test(#[strategy(1..2)] mut x: i32) {
  x = 0;
}

It would be nice to keep the mut keyword. My usecase is for generating a Vec and then removing duplicates.

frozenlib commented 3 years ago

Thanks for posting the issue.

I have fixed this issue in 55646548e7ca5557db54b0aa24913044682eeb82.

lemmih commented 3 years ago

Awesome!

brunocodutra commented 3 years ago

@frozenlib anything missing before a new version that includes this fix can be released? Anything you need help with?

frozenlib commented 3 years ago

There didn't seem to be any problems, so I have just released a new version.