-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid testProperty deprecation warnings with tasty-hedgehog-1.2
This fixes #195—or, at the very least, makes the deprecation warnings that arise from `tasty-hedgehog`'s version of `testProperty` go away. The "real" fix would be to convert every use of `testProperty` into a top-level `Property` value, but given how tedious that would be, I'm disinclined to do this unless someone specifically requests it.
- Loading branch information
1 parent
4183a84
commit 2bd3b5d
Showing
6 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- | Like "Test.Tasty.Hedgehog", but instead exposing an alternative | ||
-- implementation of 'testProperty' that does not induce deprecation warnings. | ||
module Test.Tasty.Hedgehog.Alt | ||
( module TTH | ||
, testProperty | ||
) where | ||
|
||
import Data.String (IsString(fromString)) | ||
import Hedgehog (Property) | ||
import Test.Tasty (TestName, TestTree) | ||
import Test.Tasty.Hedgehog as TTH hiding (testProperty) | ||
|
||
-- | Create a 'T.TestTree' from a Hedgehog 'Property'. | ||
-- | ||
-- Note that @tasty-hedgehog@'s version of 'testProperty' has been deprecated | ||
-- in favor of 'testPropertyNamed', whose second argument is intended to | ||
-- represent the name of a top-level 'Property' value to run in the event that | ||
-- the test fails. See https://github.com/qfpl/tasty-hedgehog/pull/42. | ||
-- | ||
-- That being said, @what4@ currently does not define any of the properties | ||
-- that it tests as top-level values, and it would be a pretty significant | ||
-- undertaking to migrate all of the properties to top-level values. In the | ||
-- meantime, we avoid incurring deprecation warnings by defining our own | ||
-- version of 'testProperty'. The downside to this workaround is that if a | ||
-- property fails, the error message it will produce will likely suggest | ||
-- running ill-formed Haskell code, so users will have to use context clues to | ||
-- determine how to /actually/ reproduce the error. | ||
testProperty :: TestName -> Property -> TestTree | ||
testProperty name = testPropertyNamed name (fromString name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters