-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Custom examples for property(..., context(), ...)? #1825
Comments
Hello, There is today no way to build partial or incomplete examples. A proposal to do so was suggested in the issue #710 (comment) but for the moment it has not been implemented. Regarding Given what has been released so far, the only trick I'd have is: const buildContext = () => fc.sample(fc.context(), {numRuns:1})[0];
fc.assert(
fc.property(fc.string(), fc.context(), (str, ctx) => /* ... */),
{ examples: [["x", buildContext()]] }
); Not perfect but it should work well. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
💬 Question and Help
It is unclear to me how to provide a custom example for the following:
context()
seems to instantiate an class which is not exported. I would prefer not to make my own implementation ofContextValue
.It would be the most convenient not to have to include a value corresponding to the context in the examples at all – maybe the arbitraries provided to the property call could be used if there are more of them than elements in the example tuples – but any solution that gets this to work is good enough. Thanks!
The text was updated successfully, but these errors were encountered: