another quickcheck
This commit is contained in:
parent
df1540787f
commit
df90a2acd5
2 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
|
|
2
test.hs
2
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
|
||||
|
|
Loading…
Reference in a new issue