Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Make invariants return true by default? #15

Open
robotlolita opened this issue Mar 25, 2013 · 2 comments
Open

Make invariants return true by default? #15

robotlolita opened this issue Mar 25, 2013 · 2 comments

Comments

@robotlolita
Copy link
Member

This would allow a better integration with testing libraries. Right now, if you don't return anything from your property, the property fails. This is cool if you're doing comparisons in your property, since you're always returning a value anyways, but assertion libraries don't usually return a value, and as such you have to end all your properties with return true, which makes it not obvious what's being tested.

@kennknowles
Copy link
Contributor

Perhaps a warning or just an informative failure message for properties that return undefined, since that is unlikely to occur in Claire's style. Maybe an implicit classifier of test cases into which falsey value they return.

@robotlolita
Copy link
Member Author

Hm. Currently Claire uses null to signal that a test case was ignored. I can construct a disjoint type to handle this better and have Ignored <reason> | Success <value> | Rejected <value> | Failed <reason>. That way I believe it should be easy to provide a better reasoning for properties that are rejected with a falsy value.

robotlolita added a commit that referenced this issue Apr 21, 2013
This helps with #20 and #15. As for the latter, I still don't know whether to provide special handling for assertion-based tests or not.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants