-
Notifications
You must be signed in to change notification settings - Fork 23
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
Implement labelledExamples #167
Conversation
d92955b
to
3bf9c82
Compare
@dwijnand I'm definitely ok with taking some experimental code. I think my only preference here would not be to duplicate any of that logic though (those 2 functions in particular are critical to how it all hangs together). If we can either share what we can with common functions and possibly have some parameters/callbacks that might avoid us having to keep the two in sync. In particular, I know those functions have been refactored for I don't have any specific suggestions though I'm afraid. |
Alright, I'll seek to dedup. |
58149d5
to
ad8662c
Compare
309d9d3
to
932a814
Compare
932a814
to
3159849
Compare
... if present and different to the label name itself.
Can this be merged and released? I think I left this in a state I was very happy with: useful and deduped - but happy to have another look if a fresh review spots anything. |
Is there a way of doing partest neg equivalent to see what gets printed on the screen when some test fails? |
No, there's no setup for testing the behaviour of runner, just unit tests for the core's behaviour. (See also test/README.md 🙂) |
My interest is in the negative behavior like in this case how the example affect the test failure output, not so much the details of different runners. |
Before:
After:
using , property("testReverse", testReverse).withExamples
, property("testReverseFail", testReverseFail).withExamples
...
def testReverse: Property =
for {
xs <- Gen.alpha.list(Range.linear(0, 10)).forAll
.classify("empty", _.isEmpty)
.classify("nonempty", _.nonEmpty)
} yield xs.reverse.reverse ==== xs
def testReverseFail: Property =
for {
xs <- Gen.alpha.list(Range.linear(0, 10)).forAll
.classify("empty", _.isEmpty)
.classify("nonempty", _.nonEmpty)
} yield xs.reverse ==== xs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 it
Looks good! @dwijnand Would you mind updating docs as well? |
👍 Looks good @dwijnand. You should definitely feel comfortable merging if and someone else are happy with it. Don't wait for me. Just one final (probably unhelpful) thought was whether it would just be easier to always collect the examples on every run which might simply that code. It might not make sense, or not worth spending on more time on it, and in any case feel free to ignore me. :) Thanks again! |
That minimum coverage with
|
fde02b2
to
70eb1af
Compare
@charleso I think it's good to merge it now and we can consider your thought afterwards. |
@dwijnand As Charles said, please feel free to merge it. If you want to merge it but can't do it, please let me know. |
v0.5.0 has been released. |
@@ -247,6 +269,15 @@ case class DiscardCount(value: Int) { | |||
DiscardCount(value + 1) | |||
} | |||
|
|||
/** Whether the report should include an example for each label. */ | |||
sealed trait WithExamples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer used? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did that come from? #175
Fixes #163
This introduces some duplication but, more generally, I'm not sure it's doing exactly the right thing.
Particularly: how is it meant to behave on a failing property? What about None results? Also, should it only
print the journal logs, as it's doing, or also the result logs? And did I make all the correct modifications in
my "takeSmallest" copy? Lots of questions.
I'd gladly have this land in a "we're not totally sure"/experimental feature and dogfood it in a project of
mine, which might give some better insights on what design choices are better. (But I can also copy this impl
into my project, so I wouldn't be blocked either - pure FP ftw.)