diff options
author | defanor <defanor@uberspace.net> | 2017-12-20 00:22:25 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-12-20 00:22:25 +0300 |
commit | e7489043d8bf2a406a910adcb93280e83d6d2faa (patch) | |
tree | b080cab07394cc02ffd3ebbcd815813e5dc2de69 /test | |
parent | 62aa7bb8ba54c2a0f480e122c46d967f2102dac5 (diff) |
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).
Diffstat (limited to 'test')
-rw-r--r-- | test/Test.hs | 9 |
1 files changed, 5 insertions, 4 deletions
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)) ] |