-
Notifications
You must be signed in to change notification settings - Fork 161
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
can not make functions public with compose!
#10
Comments
compose!
compose!
I got to hand it to you, this is one of the most well designed and documented libraries I've ever had the pleasure of working with. I'm about an hour in and the workarond is pretty obvious:
Not that this isn't still a bug, but serious props to the entire architecture. I was using quickcheck, which I thought was quite excelent, but this is leagues beyond. Seriously well done. |
The macro predates the proptest_compose! {
[pub] fn foo()(v in prop::num::usize::ANY) -> usize {
// ...
}
} I will look into supporting |
it's not a super big emergency, I kind of like being explicit actually just figured you would appreciate the bug report |
It looks like the |
I don't think a nightly-only feature is worth it. Thanks! |
New to Rust and proptest and have the same issue with the compose macro making only private functions. Also very impressed at the level of documentation and thought that has gone into proptest. Can I ask whether the "GEN_NAME_RE" in the @vitiral workaround is a user-defined constant or a proptest constant? An example workaround function in context would be very useful. |
Since the question came up again in #10
As I mentioned above, you can make them, just not with standard rust syntax since the macro can't match them. E.g., the following compiles: #![allow(dead_code)]
#[macro_use] extern crate proptest;
mod one {
prop_compose! {
[pub] fn two_ints()(a in 0..10, b in 0..20) -> (i32, i32) {
(a, b)
}
}
}
mod two {
use super::one::two_ints;
proptest! {
// commented so it always gets compiled for this example
//#[test]
fn test_something(_a in two_ints()) {
// ...
}
}
}
fn main() { }
It's user-defined. From other conversations I believe it is a string literal (i.e., a regex-based strategy). |
Many thanks, that's exactly what I was looking for. |
Update: The |
As of 0.9.0, visibility modifiers can be used directly. |
I can't seem to make a function public
has this error when compiled:
The text was updated successfully, but these errors were encountered: