Fixed warning about \n in echo -n -e '\n'
This commit is contained in:
parent
8bd4365cdb
commit
c3cc5f649f
|
@ -1577,11 +1577,14 @@ prop_checkUnusedEchoEscapes1 = verify checkUnusedEchoEscapes "echo 'foo\\nbar\\n
|
||||||
prop_checkUnusedEchoEscapes2 = verifyNot checkUnusedEchoEscapes "echo -e 'foi\\nbar'"
|
prop_checkUnusedEchoEscapes2 = verifyNot checkUnusedEchoEscapes "echo -e 'foi\\nbar'"
|
||||||
prop_checkUnusedEchoEscapes3 = verify checkUnusedEchoEscapes "echo \"n:\\t42\""
|
prop_checkUnusedEchoEscapes3 = verify checkUnusedEchoEscapes "echo \"n:\\t42\""
|
||||||
prop_checkUnusedEchoEscapes4 = verifyNot checkUnusedEchoEscapes "echo lol"
|
prop_checkUnusedEchoEscapes4 = verifyNot checkUnusedEchoEscapes "echo lol"
|
||||||
|
prop_checkUnusedEchoEscapes5 = verifyNot checkUnusedEchoEscapes "echo -n -e '\n'"
|
||||||
checkUnusedEchoEscapes _ = checkCommand "echo" (const f)
|
checkUnusedEchoEscapes _ = checkCommand "echo" (const f)
|
||||||
where
|
where
|
||||||
isDashE = mkRegex "^-.*e"
|
isDashE = mkRegex "^-.*e"
|
||||||
hasEscapes = mkRegex "\\\\[rnt]"
|
hasEscapes = mkRegex "\\\\[rnt]"
|
||||||
f (arg:_) | (concat $ deadSimple arg) `matches` isDashE = return ()
|
f args | (concat $ concatMap deadSimple allButLast) `matches` isDashE =
|
||||||
|
return ()
|
||||||
|
where allButLast = reverse . drop 1 . reverse $ args
|
||||||
f args = mapM_ checkEscapes args
|
f args = mapM_ checkEscapes args
|
||||||
|
|
||||||
checkEscapes (T_NormalWord _ args) =
|
checkEscapes (T_NormalWord _ args) =
|
||||||
|
|
Loading…
Reference in New Issue