-
Notifications
You must be signed in to change notification settings - Fork 20
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
Allow for different test and property names #42
Conversation
@gwils ? |
@andreabedini Do you want to be a maintainer of tasty-hedgehog? I'd be happy for you to merge this PR and make a new release. |
I would be happy to volunteer for this 🙂 |
Done. |
Regarding this PR, what do you think of having two versions of these functions? One where both names are the same (the current behaviour) and one where they can vary (as in this PR)? |
Same as on here: mbg.
I had some time to think about this recently and thought of another possible approach: we could combine the data HedgehogName = HN TestName PropertyName
instance IsString HedgehogName where
fromString name = HN name (fromString name) This way existing code and behaviour would not need to change, except for having to enable Do you have any thoughts on that? I can implement either this or the two different functions (or both) and rebase everything to be up-to-date. |
I would prefer the two different functions approach. This usage of |
1c8f0a4
to
e05256e
Compare
I have moved the changes into a new In ac441fb, I have added some changes to discourage the use of |
(If you are happy with ac441fb, I should probably update the README as well.) |
Ok, thanks, I didn't fully understand everything that was going on here until I read your haddock string and deprecation message. I'm the on the same page now. |
I'll make a hackage release of this within about 48 hours and add you as a hackage maintainer while I'm there. |
<3 |
@mbg I've compiled and run this now. Can you please open a new PR adding a no-deprecation-warning GHC pragma to our test file, so that our test suite doesn't generate warnings? |
That's great to hear! Sorry that the original explanation in the PR description didn't make this clear!
Done in #52. |
Released to hackage as tasty-hedgehog 1.2.0.0 and I've made you a maintainer on hackage @mbg |
Awesome, thanks! |
Should |
Yes, the intention is for |
I've had to do both at the same time because I don't have a Stackage snapshot with GHC 9.0 and tasty-hedgehog 1.2. The `testProperty` function has been deprecated in the current 1.2 version. See qfpl/tasty-hedgehog#42 for the reason. The `testProperty` function is replaced by `testPropertyNamed` which requires one extra argument (the name of the test function as a string). There were a test for which the property didn't have a name, so I had to name it. We also need `-XOverloadedString` in every module (some already have it). Upgrading the stack snapshot to GHC 9.2 didn't require any action. Upgrading the stack snapshot is part of #389.
I've had to do both at the same time because I don't have a Stackage snapshot with GHC 9.0 and tasty-hedgehog 1.2. The `testProperty` function has been deprecated in the current 1.2 version. See qfpl/tasty-hedgehog#42 for the reason. The `testProperty` function is replaced by `testPropertyNamed` which requires one extra argument (the name of the test function as a string). There were a test for which the property didn't have a name, so I had to name it. We also need `-XOverloadedString` in every module (some already have it). Upgrading the stack snapshot to GHC 9.2 didn't require any action. Upgrading the stack snapshot is part of #389.
The `testProperty` function has been deprecated in the current 1.2 version. See qfpl/tasty-hedgehog#42 for the reason. The `testProperty` function is replaced by `testPropertyNamed` which requires one extra argument (the name of the test function as a string). There were a test for which the property didn't have a name, so I had to name it. We also need `-XOverloadedString` in every module (some already have it).
The `testProperty` function has been deprecated in the current 1.2 version. See qfpl/tasty-hedgehog#42 for the reason. The `testProperty` function is replaced by `testPropertyNamed` which requires one extra argument (the name of the test function as a string). There were a test for which the property didn't have a name, so I had to name it. We also need `-XOverloadedString` in every module (some already have it).
This PR changes
testProperty
to take an extra parameter which allows users to specify a name for the property that's different from the name of the test. Currently the output we get fromhedgehog
for a failing test wrongly instructs users to e.g.:This would obviously never work.
hedgehog
seems to encourage/assume that the property name is set to the name of the function that implements it, so this allows users oftasty-hedgehog
to specify that separately from the test name. With the changes, we can now get the more useful: