Fixed warning for tr abc '[d*]'

This commit is contained in:
Vidar Holen 2012-12-01 13:19:40 -08:00
parent b144700ae0
commit 8c1ab0c9b6
1 changed files with 2 additions and 1 deletions

View File

@ -583,6 +583,7 @@ prop_checkTr6 = verify checkTr "tr 'hello' 'world'"
prop_checkTr8 = verifyNot checkTr "tr aeiou _____" prop_checkTr8 = verifyNot checkTr "tr aeiou _____"
prop_checkTr9 = verifyNot checkTr "a-z n-za-m" prop_checkTr9 = verifyNot checkTr "a-z n-za-m"
prop_checkTr10= verifyNot checkTr "tr --squeeze-repeats rl lr" prop_checkTr10= verifyNot checkTr "tr --squeeze-repeats rl lr"
prop_checkTr11= verifyNot checkTr "tr abc '[d*]'"
checkTr = checkCommand "tr" (mapM_ f) checkTr = checkCommand "tr" (mapM_ f)
where where
f w | isGlob w = do -- The user will go [ab] -> '[ab]' -> 'ab'. Fixme? f w | isGlob w = do -- The user will go [ab] -> '[ab]' -> 'ab'. Fixme?
@ -596,7 +597,7 @@ checkTr = checkCommand "tr" (mapM_ f)
info (getId word) "tr replaces sets of chars, not words (mentioned due to duplicates)." info (getId word) "tr replaces sets of chars, not words (mentioned due to duplicates)."
unless ("[:" `isPrefixOf` s) $ unless ("[:" `isPrefixOf` s) $
when ("[" `isPrefixOf` s && "]" `isSuffixOf` s && (length s > 2)) $ when ("[" `isPrefixOf` s && "]" `isSuffixOf` s && (length s > 2) && (not $ '*' `elem` s)) $
info (getId word) "Don't use [] around ranges in tr, it replaces literal square brackets." info (getId word) "Don't use [] around ranges in tr, it replaces literal square brackets."
Nothing -> return () Nothing -> return ()