From e7489043d8bf2a406a910adcb93280e83d6d2faa Mon Sep 17 00:00:00 2001 From: defanor Date: Wed, 20 Dec 2017 00:22:25 +0300 Subject: Prepare for IO DSV functions operate on individual lines now, unit type gets printed/parsed as nothing (handier for argument parsing to set '()' when there's none, and that's what it should be anyway). --- test/Test.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/Test.hs b/test/Test.hs index 8ef6a3a..0836220 100644 --- a/test/Test.hs +++ b/test/Test.hs @@ -67,7 +67,7 @@ instance Arbitrary NestedSum where arbitrary = genericArbitraryU data RecursiveRecordMaybe = RecursiveRecordMaybe { rrm :: Maybe RecursiveRecordMaybe , record :: Maybe Record - , guard :: () + , guard :: Word8 } deriving (Generic, Eq, Show, Coalpit) instance Arbitrary RecursiveRecordMaybe where arbitrary = genericArbitraryU @@ -75,7 +75,7 @@ data RecursiveRecordMaybe2 = RecursiveRecordMaybe2 { record1' :: Maybe Record , rrm' :: Maybe (Maybe RecursiveRecordMaybe2) , record2' :: Maybe Record - , guard' :: () + , guard' :: Word8 } deriving (Generic, Eq, Show, Coalpit) instance Arbitrary RecursiveRecordMaybe2 where arbitrary = genericArbitraryU @@ -96,7 +96,7 @@ printAndParseDSV :: (Coalpit a, Eq a) => Options -> Proxy a -> (a, Int) -> Bool printAndParseDSV opt _ (x, n) = let xs = (replicate (n `mod` 3) x) - in xs == rights (readDSV opt (showDSV opt xs)) + in xs == (rights . map (readDSV opt) . lines . unlines . map (showDSV opt) $ xs) variousTypes :: (forall a. (Coalpit a, Eq a, Show a, Arbitrary a) => @@ -135,7 +135,8 @@ qcProps = testGroup "Quickcheck properties" [ testGroup "Right == fromArgs opt . toArgs opt" (variousOptions $ \opt -> variousTypes $ \p n -> QC.testProperty n (printAndParse opt p)) - , testGroup "id == rights . readDSV opt . showDSV opt" + , testGroup + "id == rights . map (readDSV opt) . lines . unlines . map (showDSV opt)" (variousOptions $ \opt -> variousTypes $ \p n -> QC.testProperty n (printAndParseDSV opt p)) ] -- cgit v1.2.3