-
Notifications
You must be signed in to change notification settings - Fork 36
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
Improving correctness #95
Comments
Oh, I see that there is already an prettyprinter/prettyprinter/test/Testsuite/Main.hs Lines 79 to 99 in 4d51362
|
Here's a property for #83: When layouting |
The main difficulty here is putting the properties into code, but I totally agree! The |
Another property had come up in #89:
But
with |
@sjakobi Not sure that will work much better, currently I literally just generate random elements of Doc (without Union/Fail to preserve invariants although you could call group on them randomly to produce those as well). Shrinking is also done manually for most of it as I too use a quickcheck derivative for tests. I'll change those tests to more hedgehog style tests later this week to check out how well integrated shrinking works, it seems to be the better choice if you want to preserve invariants on more complex datatypes without writing shrinkers manually. |
@1Jajen1 Well somehow your tests were able to detect the problems with the modified Which properties did you check there? |
So what I have right now is basically just a few property tests: (The kotlin source for these is actually readable!) They actually find a bug in |
#126 (comment) lists a bunch of tests from |
I'm quite impressed by (and a bit proud of!) the number of bugs that has been revealed through
dhall
's usage ofprettyprinter
!I wonder how
prettyprinter
could rely less on the users to discover these bugs though.In particular I wonder whether property tests could help – IMHO they've been quite effective in
dhall
!For example I believe that the recent bugs could have been discovered by tests for the following properties:
group
ed Line fails #91: The result of applyinglayout{Pretty,Smart} opts . group
to aDoc
that doesn't containFail
, should never containSFail
.removeTrailingWhitespace
:removeTrailingWhitespace
is idempotent.It's probably more difficult to come up with properties that would reveal unknown bugs, but it might be worth trying!
The text was updated successfully, but these errors were encountered: