Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ShellCheck/Analytics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,7 @@ prop_checkValidCondOps2 = verify checkValidCondOps "[ -M a ]"
prop_checkValidCondOps2a = verifyNot checkValidCondOps "[ 3 \\> 2 ]"
prop_checkValidCondOps3 = verifyNot checkValidCondOps "[ 1 = 2 -a 3 -ge 4 ]"
prop_checkValidCondOps4 = verifyNot checkValidCondOps "[[ ! -v foo ]]"
prop_checkValidCondOps5 = verifyNot checkValidCondOps "[ \\! -e foo ]"
checkValidCondOps _ (TC_Binary id _ s _ _)
| s `notElem` binaryTestOps =
warn id 2057 "Unknown binary operator."
Expand Down
3 changes: 2 additions & 1 deletion src/ShellCheck/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ readConditionContents single =

readCondNot = do
start <- startSpan
char '!'
if single then void (try (readRegularOrEscaped (string "!"))) else void (char '!')
id <- endSpan start
spacingOrLf
expr <- readCondExpr
Expand Down Expand Up @@ -947,6 +947,7 @@ prop_readCondition26 = isOk readScript "[[ foo ]]\\\n && bar"
prop_readCondition27 = not $ isOk readConditionCommand "[[ x ]] foo"
prop_readCondition28 = isOk readCondition "[[ x = [\"$1\"] ]]"
prop_readCondition29 = isOk readCondition "[[ x = [*] ]]"
prop_readCondition30 = isOk readCondition "[ \\! \\( -e foo -a -e bar \\) ]"

readCondition = called "test expression" $ do
opos <- getPosition
Expand Down
Loading