Allow quoting values in directives (fixes #2517)

This commit is contained in:
Vidar Holen 2022-07-28 08:56:44 -07:00
parent f440912279
commit d0dd81e1fa
4 changed files with 33 additions and 6 deletions

View file

@ -244,6 +244,9 @@ prop_canStripPrefixAndSource2 =
prop_canSourceDynamicWhenRedirected =
null $ checkWithIncludes [("lib", "")] "#shellcheck source=lib\n. \"$1\""
prop_canRedirectWithSpaces =
null $ checkWithIncludes [("my file", "")] "#shellcheck source=\"my file\"\n. \"$1\""
prop_recursiveAnalysis =
[2086] == checkRecursive [("lib", "echo $1")] "source lib"
@ -413,6 +416,15 @@ prop_sourcePathAddsAnnotation = result == [2086]
csCheckSourced = True
}
prop_sourcePathWorksWithSpaces = result == [2086]
where
f "dir/myscript" _ ["my path"] "lib" = return "foo/lib"
result = checkWithIncludesAndSourcePath [("foo/lib", "echo $1")] f emptyCheckSpec {
csScript = "#!/bin/bash\n# shellcheck source-path='my path'\nsource lib",
csFilename = "dir/myscript",
csCheckSourced = True
}
prop_sourcePathRedirectsDirective = result == [2086]
where
f "dir/myscript" _ _ "lib" = return "foo/lib"