From 0bb617ff93d242d20e9e63f44664f38a653898d4 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 10 Jan 2016 00:30:18 +0000 Subject: reworked test harness for (partial) auto-detection --- spec/src/Thermoprint/Printout.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'spec/src/Thermoprint') diff --git a/spec/src/Thermoprint/Printout.hs b/spec/src/Thermoprint/Printout.hs index 7c6d5c0..32c403c 100644 --- a/spec/src/Thermoprint/Printout.hs +++ b/spec/src/Thermoprint/Printout.hs @@ -149,12 +149,13 @@ cotext (Line x) = cotext' x cotext' (HSpace n) = TL.pack . genericReplicate n $ ' ' cotext' (SpaceSep xs) = TL.intercalate " " . map cotext' . toList $ xs -prop_text :: Property --- ^ prop> cotext . either id Line . `text` $ x = x +prop_text :: Text -> Bool +-- ^ prop> (`cotext` . either id Line . `text` $ x) == x -- -- Where 'x' is restricted to those `TL.Text` which do not contain whitespace besides ' ' and '\n'. -prop_text = forAll (TL.map normSpace <$> arbitrary) $ \x -> (cotext . either id Line . text $ x) == x +prop_text x = (cotext . either id Line . text $ x') == x' where + x' = TL.map normSpace x normSpace c | isSpace c , c `elem` keep = c -- cgit v1.2.3