mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-06 13:01:39 -07:00
Expand root paths into source paths
This commit is contained in:
parent
af46758ff1
commit
c6c12f52bd
6 changed files with 70 additions and 30 deletions
|
@ -150,6 +150,11 @@ checkOptionIncludes includes src =
|
|||
checkWithRc rc = getErrors
|
||||
(mockRcFile rc $ mockedSystemInterface [])
|
||||
|
||||
checkWithIncludesAndSourcePath includes mapper = getErrors
|
||||
(mockedSystemInterface includes) {
|
||||
siFindSource = mapper
|
||||
}
|
||||
|
||||
prop_findsParseIssue = check "echo \"$12\"" == [1037]
|
||||
|
||||
prop_commentDisablesParseIssue1 =
|
||||
|
@ -335,5 +340,24 @@ prop_brokenRcGetsWarning = result == [1134, 2086]
|
|||
csIgnoreRC = False
|
||||
}
|
||||
|
||||
prop_sourcePathRedirectsName = result == [2086]
|
||||
where
|
||||
f "dir/myscript" "lib" = return "foo/lib"
|
||||
result = checkWithIncludesAndSourcePath [("foo/lib", "echo $1")] f emptyCheckSpec {
|
||||
csScript = "#!/bin/bash\nsource lib",
|
||||
csFilename = "dir/myscript",
|
||||
csCheckSourced = True
|
||||
}
|
||||
|
||||
prop_sourcePathRedirectsDirective = result == [2086]
|
||||
where
|
||||
f "dir/myscript" "lib" = return "foo/lib"
|
||||
f _ _ = return "/dev/null"
|
||||
result = checkWithIncludesAndSourcePath [("foo/lib", "echo $1")] f emptyCheckSpec {
|
||||
csScript = "#!/bin/bash\n# shellcheck source=lib\nsource kittens",
|
||||
csFilename = "dir/myscript",
|
||||
csCheckSourced = True
|
||||
}
|
||||
|
||||
return []
|
||||
runTests = $quickCheckAll
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue