still fixing this sigh

This commit is contained in:
Joey Hess 2019-01-21 18:39:25 -04:00
parent 47cb1a98b6
commit b79ef475ac
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -94,10 +94,14 @@ prop_parse_show_Config :: RemoteConfig -> Bool
prop_parse_show_Config c prop_parse_show_Config c
-- whitespace and '=' are not supported in config keys -- whitespace and '=' are not supported in config keys
| any (\k -> any isSpace k || elem '=' k) (M.keys c) = True | any (\k -> any isSpace k || elem '=' k) (M.keys c) = True
-- limit to alphanumerics for simplicity | any (any excluded) (M.keys c) = True
| any (any (not . isAlphaNum)) (M.keys c) = True | any (any excluded) (M.elems c) = True
| any (any (not . isAlphaNum)) (M.elems c) = True
| otherwise = A.parseOnly remoteConfigParser (encodeBS $ showConfig c) ~~ Right c | otherwise = A.parseOnly remoteConfigParser (encodeBS $ showConfig c) ~~ Right c
where where
normalize v = sort . M.toList <$> v normalize v = sort . M.toList <$> v
a ~~ b = normalize a == normalize b a ~~ b = normalize a == normalize b
-- limit to ascii alphanumerics for simplicity; characters not
-- allowed by the current character set in the config may not
-- round-trip in an identical representation due to the use of the
-- filesystem encoding.
excluded c = not (isAlphaNum c) || not (isAscii c)