Skip to content

Commit

Permalink
tests: add new test in fixtures/sourcing.sh
Browse files Browse the repository at this point in the history
I added this to the bottom of the file to minimize snapshot diffs. they're large enough as it is.
  • Loading branch information
aarondill committed Jan 21, 2024
1 parent 67f150f commit 1ae72d3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions server/src/__tests__/analyzer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,28 @@ describe('analyze', () => {
"severity": 3,
"source": "bash-language-server",
},
{
"message": "Source command could not be analyzed: failed to resolve path.
Consider adding a ShellCheck directive above this line to fix or ignore this:
# shellcheck source=/my-file.sh # specify the file to source
# shellcheck source-path=my_script_folder # specify the folder to search in
# shellcheck source=/dev/null # to ignore the error
Disable this message by changing the configuration option "enableSourceErrorDiagnostics"",
"range": {
"end": {
"character": 49,
"line": 26,
},
"start": {
"character": 0,
"line": 26,
},
},
"severity": 3,
"source": "bash-language-server",
},
]
`)

Expand Down Expand Up @@ -847,6 +869,7 @@ describe('initiateBackgroundAnalysis', () => {
[expect.stringContaining('parse-problems.sh: syntax error')],
[expect.stringContaining('sourcing.sh line 16: failed to resolve path')],
[expect.stringContaining('sourcing.sh line 21: non-constant source not supported')],
[expect.stringContaining('sourcing.sh line 26: failed to resolve path')],
])

// Intro, stats on glob, one file skipped due to shebang, and outro
Expand Down
2 changes: 2 additions & 0 deletions testing/fixtures/sourcing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ loadlib () {
}

loadlib "issue206"

source $SCRIPT_DIR/tag-release.inc with arguments

0 comments on commit 1ae72d3

Please sign in to comment.