diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-20 00:02:33 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-20 00:02:33 -0400 |
commit | a724c0e782ecc9bc097549f2c0a273da2bf61827 (patch) | |
tree | af85d520459b0a2837a682261638e8bc1c785394 | |
parent | 0ba45a9fb578cc3fc6e8cac45034e1e5bd4fea34 (diff) |
another quickcheck
-rw-r--r-- | Logs/Remote.hs | 14 | ||||
-rw-r--r-- | test.hs | 2 |
2 files changed, 15 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 @@ -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 |