diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-10 00:30:18 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-10 00:30:18 +0000 |
commit | 0bb617ff93d242d20e9e63f44664f38a653898d4 (patch) | |
tree | e007e973bd670dec4169b2f070c4bccd5efb5886 /spec/src | |
parent | 11a3a881157494508593bc2323fbc62b6ee04b5f (diff) | |
download | thermoprint-0bb617ff93d242d20e9e63f44664f38a653898d4.tar thermoprint-0bb617ff93d242d20e9e63f44664f38a653898d4.tar.gz thermoprint-0bb617ff93d242d20e9e63f44664f38a653898d4.tar.bz2 thermoprint-0bb617ff93d242d20e9e63f44664f38a653898d4.tar.xz thermoprint-0bb617ff93d242d20e9e63f44664f38a653898d4.zip |
reworked test harness for (partial) auto-detection
Diffstat (limited to 'spec/src')
-rw-r--r-- | spec/src/Thermoprint/Printout.hs | 7 |
1 files changed, 4 insertions, 3 deletions
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 | |||
149 | cotext' (HSpace n) = TL.pack . genericReplicate n $ ' ' | 149 | cotext' (HSpace n) = TL.pack . genericReplicate n $ ' ' |
150 | cotext' (SpaceSep xs) = TL.intercalate " " . map cotext' . toList $ xs | 150 | cotext' (SpaceSep xs) = TL.intercalate " " . map cotext' . toList $ xs |
151 | 151 | ||
152 | prop_text :: Property | 152 | prop_text :: Text -> Bool |
153 | -- ^ prop> cotext . either id Line . `text` $ x = x | 153 | -- ^ prop> (`cotext` . either id Line . `text` $ x) == x |
154 | -- | 154 | -- |
155 | -- Where 'x' is restricted to those `TL.Text` which do not contain whitespace besides ' ' and '\n'. | 155 | -- Where 'x' is restricted to those `TL.Text` which do not contain whitespace besides ' ' and '\n'. |
156 | prop_text = forAll (TL.map normSpace <$> arbitrary) $ \x -> (cotext . either id Line . text $ x) == x | 156 | prop_text x = (cotext . either id Line . text $ x') == x' |
157 | where | 157 | where |
158 | x' = TL.map normSpace x | ||
158 | normSpace c | 159 | normSpace c |
159 | | isSpace c | 160 | | isSpace c |
160 | , c `elem` keep = c | 161 | , c `elem` keep = c |