From a724c0e782ecc9bc097549f2c0a273da2bf61827 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 20 Dec 2012 00:02:33 -0400 Subject: another quickcheck --- Logs/Remote.hs | 14 +++++++++++++- test.hs | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) 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 diff --git a/test.hs b/test.hs index fb0cdfda5..fcd4e3136 100644 --- a/test.hs +++ b/test.hs @@ -10,6 +10,7 @@ import Test.HUnit import Test.HUnit.Tools import Test.QuickCheck +import Test.QuickCheck.Instances () import System.Posix.Directory (changeWorkingDirectory) import System.Posix.Files @@ -107,6 +108,7 @@ quickcheck = TestLabel "quickcheck" $ TestList , qctest "prop_idempotent_shellEscape" Utility.SafeCommand.prop_idempotent_shellEscape , qctest "prop_idempotent_shellEscape_multiword" Utility.SafeCommand.prop_idempotent_shellEscape_multiword , qctest "prop_idempotent_configEscape" Logs.Remote.prop_idempotent_configEscape + , qctest "prop_parse_show_Config" Logs.Remote.prop_parse_show_Config , qctest "prop_parentDir_basics" Utility.Path.prop_parentDir_basics , qctest "prop_relPathDirToFile_basics" Utility.Path.prop_relPathDirToFile_basics , qctest "prop_relPathDirToFile_regressionTest" Utility.Path.prop_relPathDirToFile_regressionTest -- cgit v1.2.3