Skip to content
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

Merged
merged 14 commits into from
Jan 26, 2019
Merged

Proptest-derive book #104

merged 14 commits into from
Jan 26, 2019

Conversation

AltSysrq
Copy link
Collaborator

@AltSysrq AltSysrq commented Nov 3, 2018

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.

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.
@AltSysrq AltSysrq mentioned this pull request Nov 3, 2018
20 tasks
Copy link
Collaborator

@Centril Centril left a 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.

proptest-derive/src/error.rs Show resolved Hide resolved
proptest-derive/src/error.rs Show resolved Hide resolved
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.
Copy link
Collaborator

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)

book/src/proptest-derive/errors.md Outdated Show resolved Hide resolved
book/src/proptest-derive/errors.md Outdated Show resolved Hide resolved
book/src/proptest-derive/errors.md Outdated Show resolved Hide resolved
book/src/proptest-derive/errors.md Show resolved Hide resolved

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Collaborator

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...

@@ -0,0 +1,9 @@
# The `proptest-derive` crate
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah :)


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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

book/src/proptest-derive/modifiers.md Outdated Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Outdated Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Outdated Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Outdated Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Outdated Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Outdated Show resolved Hide resolved
book/src/proptest-derive/modifiers.md Outdated Show resolved Hide resolved
@AltSysrq AltSysrq changed the title [WIP] Proptest-derive book Proptest-derive book Jan 26, 2019
@AltSysrq
Copy link
Collaborator Author

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.

@Centril
Copy link
Collaborator

Centril commented Jan 26, 2019

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...).

@AltSysrq
Copy link
Collaborator Author

Yeah, I was planning on working towards 0.9.0.

@AltSysrq AltSysrq merged commit a2371d8 into proptest-derive Jan 26, 2019
@AltSysrq AltSysrq deleted the proptest-derive-book branch January 26, 2019 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants