daytripper 0.4.0 → 1.0.0
raw patch · 4 files changed
+19/−21 lines, 4 filesdep −hedgehogdep ~prop-unitPVP ok
version bump matches the API change (PVP)
Dependencies removed: hedgehog
Dependency ranges changed: prop-unit
API changes (from Hackage documentation)
- Test.Daytripper: mkFileRT :: TestName -> Expect (PropertyT IO) a ByteString c -> FilePath -> Maybe a -> RT
+ Test.Daytripper: mkFileRT :: TestName -> Expect (TestT IO) a ByteString c -> FilePath -> Maybe a -> RT
- Test.Daytripper: mkUnitRT :: TestName -> Expect (PropertyT IO) a b c -> a -> RT
+ Test.Daytripper: mkUnitRT :: TestName -> Expect (TestT IO) a b c -> a -> RT
- Test.Daytripper: testRT :: TestLimit -> RT -> TestTree
+ Test.Daytripper: testRT :: Maybe TestLimit -> RT -> TestTree
Files
- README.md +0/−2
- daytripper.cabal +3/−4
- src/Test/Daytripper.hs +13/−11
- test/Main.hs +3/−4
README.md view
@@ -5,5 +5,3 @@ You can control some parameters through Tasty: `--daydripper-write-missing` or `TASTY_DAYTRIPPER_WRITE_MISSING=True` will write golden files if not found.--`--falsify-tests=N` or `TASTY_FALSIFY_TESTS=N` will set the number of tests per property.
daytripper.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: daytripper-version: 0.4.0+version: 1.0.0 synopsis: Helpers for round-trip tests description: Please see the README on GitHub at <https://github.com/ejconlon/daytripper#readme> homepage: https://github.com/ejconlon/daytripper#readme@@ -62,7 +62,7 @@ , bytestring >=0.11 && <0.13 , directory ==1.3.* , optparse-applicative >=0.17 && <0.19- , prop-unit ==0.2.*+ , prop-unit >=1.0.1 && <1.1 , tagged ==0.8.* , tasty >=1.4 && <1.6 , tasty-hunit ==0.10.*@@ -106,9 +106,8 @@ , bytestring >=0.11 && <0.13 , daytripper , directory ==1.3.*- , hedgehog ==1.5.* , optparse-applicative >=0.17 && <0.19- , prop-unit ==0.2.*+ , prop-unit >=1.0.1 && <1.1 , tagged ==0.8.* , tasty >=1.4 && <1.6 , tasty-hunit ==0.10.*
src/Test/Daytripper.hs view
@@ -21,10 +21,11 @@ import Data.ByteString (ByteString) import Data.ByteString qualified as BS import Data.Foldable (for_)+import Data.Maybe (fromMaybe) import Data.Proxy (Proxy (..)) import Data.Tagged (Tagged, untag) import Options.Applicative (flag', help, long)-import PropUnit (Gen, PropertyT, TestLimit, forAll, setupTests, testProp, testUnit, (===))+import PropUnit (Gen, PropertyT, TestLimit, TestT, defaultTestLimit, forAll, setupTests, testProp, testUnit, (===)) import System.Directory (doesFileExist) import Test.Tasty (TestName, TestTree, askOption, defaultIngredients, defaultMainWithIngredients, includingOptions) import Test.Tasty.Ingredients (Ingredient)@@ -77,14 +78,15 @@ mkPropRT :: (Show a) => TestName -> Expect (PropertyT IO) a b c -> Gen a -> RT mkPropRT name expec gen = RTProp (PropRT name expec gen) -testPropRT :: TestLimit -> PropRT -> TestTree-testPropRT lim (PropRT name expec gen) =- testProp name lim (forAll gen >>= void . runExpect expec)+testPropRT :: Maybe TestLimit -> PropRT -> TestTree+testPropRT mlim (PropRT name expec gen) =+ let lim = fromMaybe defaultTestLimit mlim+ in testProp name lim (forAll gen >>= void . runExpect expec) data FileRT where FileRT :: TestName- -> Expect (PropertyT IO) a ByteString c+ -> Expect (TestT IO) a ByteString c -> FilePath -> Maybe a -> FileRT@@ -92,7 +94,7 @@ -- | Create a file-based ("golden") roundtrip test mkFileRT :: TestName- -> Expect (PropertyT IO) a ByteString c+ -> Expect (TestT IO) a ByteString c -> FilePath -> Maybe a -> RT@@ -118,10 +120,10 @@ Just _ -> pure () data UnitRT where- UnitRT :: TestName -> Expect (PropertyT IO) a b c -> a -> UnitRT+ UnitRT :: TestName -> Expect (TestT IO) a b c -> a -> UnitRT -- | Create a unit roundtrip test-mkUnitRT :: TestName -> Expect (PropertyT IO) a b c -> a -> RT+mkUnitRT :: TestName -> Expect (TestT IO) a b c -> a -> RT mkUnitRT name expec val = RTUnit (UnitRT name expec val) testUnitRT :: UnitRT -> TestTree@@ -134,9 +136,9 @@ | RTUnit !UnitRT -- | Run a roundtrip test-testRT :: TestLimit -> RT -> TestTree-testRT lim = \case- RTProp x -> testPropRT lim x+testRT :: Maybe TestLimit -> RT -> TestTree+testRT mlim = \case+ RTProp x -> testPropRT mlim x RTFile x -> testFileRT x RTUnit x -> testUnitRT x
test/Main.hs view
@@ -9,10 +9,9 @@ import Data.ByteString (ByteString) import Data.ByteString qualified as BS import Data.Maybe (isJust, isNothing)-import Hedgehog.Gen qualified as Gen-import PropUnit (MonadTest, assert, (===))+import PropUnit (MonadTest, assert, testGroup, (===))+import PropUnit.Hedgehog.Gen qualified as Gen import Test.Daytripper (Expect, daytripperMain, mkExpect, mkFileRT, mkPropRT, mkUnitRT, testRT)-import Test.Tasty (testGroup) type Cmp m = Maybe ByteString -> Maybe ByteString -> m () @@ -40,7 +39,7 @@ daytripperMain $ \lim -> testGroup "Daytripper" $ fmap- (testRT lim)+ (testRT (Just lim)) [ mkPropRT "prop" expecOk (Gen.element ["a", "b"]) , mkUnitRT "unit" expecOk "a" , mkFileRT "file just" expecOk "testdata/b.txt" (Just "b")