-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proptest-derive book #104
Proptest-derive book #104
Conversation
The first few sections were taken from https://gist.github.com/Centril/5be8f6383c888a16d75b8c46f4310e82 A few of the error messages in the Rust code did not appear to be worded correctly (I assume they refer to bahviour from an older version of the implementation). I adjusted these to match my understanding of the errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
I have mostly some improvement suggestions, some asides (for later) and a few other notes.
While the generated code could work if the type given by `param` is the same as | ||
that for the default strategy, there would be no purpose in specifying the | ||
parameter type by hand; therefore specifying only `param` is in all cases | ||
forbidden. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: Maybe we should have some way of feeding a value into any_with
? Like:
#[derive(Debug, Arbitrary)]
struct Foo {
#[proptest(with = 42)]
bar: Bar,
}
==> any_with::<Bar>(42)
|
||
Proptest is a property testing framework (i.e., the QuickCheck family) | ||
inspired by the [Hypothesis](http://hypothesis.works/) framework for | ||
Python. It allows to test that certain properties of your code hold for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python. It allows to test that certain properties of your code hold for | |
Python. It allows you to test that certain properties of your code hold for |
|
||
The API is unlikely to see drastic breaking changes, but there may still be | ||
minor breaking changes here and there, particularly when "impl Trait" | ||
becomes stable and after the upcoming redesign of the `rand` crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit has mostly happened?
I think maybe we should point to GATs instead now...
book/src/proptest-derive/pd/index.md
Outdated
@@ -0,0 +1,9 @@ | |||
# The `proptest-derive` crate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this file seems to be an unused duplicate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I plan to deduplicate it once I start actually working on the proptest section. Roughly, my plan is to move most of the exposition in lib.rs
to the book, and then generate the readme from sections of the book.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah :)
Also fix a couple minor errors I noticed along the way.
|
||
Form: `#[proptest(filter = F)]` or `#[proptest(filter(F))]` where `F` is either | ||
a bare identifier or a Rust expression in a string. In either case, the | ||
parameter must evaluate to something which is `Fn (&T) -> bool`, where `T` is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parameter must evaluate to something which is `Fn (&T) -> bool`, where `T` is | |
parameter must evaluate to something which is `Fn(&T) -> bool`, where `T` is |
The book could probably do with more expansion, but I'm going to move forward with what I have here in order to get the ball rolling on a release since the docs should be sufficient for people to get started at least. |
Yeah that sounds good; I might take a pass over the text after you've merged it and maybe make a PR. Thanks for your hard work. I'll try to get back to proptest-derive in a few days but I've been swamped with language and release team duties. :) Btw, Rust 1.32 has released, so maybe we should do a 0.9.0 release soon (but there are some things I'd like to go over before that...). |
Yeah, I was planning on working towards 0.9.0. |
Adds the basic mdbook skeleton. This PR will eventually include the full book for
proptest-derive
.There's some stubs for the
proptest
section of the book, but that will not be filled further in the context of this PR.