BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.4k stars 149 forks source link

Added attr support to quickcheck! macro. #152

Closed emallson closed 7 years ago

emallson commented 7 years ago

I wanted to be able to #[ignore] some of my quickcheck tests defined with quickcheck! because they're expensive and I don't want to run them every time in dev. This (short) PR adds that ability.

I don't have tests for this, because I wasn't sure how to go about doing so. All existing tests pass, however.

quickcheck! {
    #[ignore]
    fn prop(...) -> bool {
        ...
    }
}
BurntSushi commented 7 years ago

Ah this sounds like a good change! I don't think it's a breaking change. cc @bluss

I think if you just add a test like this one that uses the #[ignore] attribute, then that should be sufficient. I think that if you did that without this change, then tests would fail to compile, right?

emallson commented 7 years ago

@BurntSushi I had forgotten about the #[should_panic] attribute. I used that with a test containing assert!(false). As long as the attributes work, it will pass.

BurntSushi commented 7 years ago

Ooo good idea! I'll wait a bit and see if @bluss wants to chime in but I think this otherwise good to go! Thanks so much!

bluss commented 7 years ago

The macro changes look good, I think it's a good idea too!

BurntSushi commented 7 years ago

Sweet off we go!

BurntSushi commented 7 years ago

0.4.1 is on crates.io.