summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-20 00:02:33 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-20 00:02:33 -0400
commita724c0e782ecc9bc097549f2c0a273da2bf61827 (patch)
treeaf85d520459b0a2837a682261638e8bc1c785394 /Logs
parent0ba45a9fb578cc3fc6e8cac45034e1e5bd4fea34 (diff)
another quickcheck
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Remote.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/Logs/Remote.hs b/Logs/Remote.hs
index 3348059b4..55fb40f4b 100644
--- a/Logs/Remote.hs
+++ b/Logs/Remote.hs
@@ -11,8 +11,11 @@ module Logs.Remote (
configSet,
keyValToConfig,
configToKeyVal,
+ showConfig,
+ parseConfig,
- prop_idempotent_configEscape
+ prop_idempotent_configEscape,
+ prop_parse_show_Config,
) where
import qualified Data.Map as M
@@ -86,3 +89,12 @@ configUnEscape = unescape
{- for quickcheck -}
prop_idempotent_configEscape :: String -> Bool
prop_idempotent_configEscape s = s == (configUnEscape . configEscape) s
+
+prop_parse_show_Config :: RemoteConfig -> Bool
+prop_parse_show_Config c
+ -- whitespace and '=' are not supported in keys
+ | any (\k -> any isSpace k || any (== '=') k) (M.keys c) = True
+ | otherwise = parseConfig (showConfig c) ~~ Just c
+ where
+ normalize v = sort . M.toList <$> v
+ a ~~ b = normalize a == normalize b