Skip to content

Commit

Permalink
tests/csdiff: cover the line content matching by a test
Browse files Browse the repository at this point in the history
... taken from a real-world example encountered
by differential-shellcheck:
redhat-plumbers-in-action/differential-shellcheck#376

Related: csutils#98
Closes: csutils#168
  • Loading branch information
jamacku authored and kdudka committed May 2, 2024
1 parent 8acc626 commit 9483a47
Show file tree
Hide file tree
Showing 7 changed files with 1,126 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/csdiff/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ test_csdiff(diff-misc 20-shellcheck-line-content)
test_csdiff(diff-misc 21-kernel-shell-code)
test_csdiff(diff-misc 22-kernel-zstream-path)
test_csdiff(diff-misc 23-cov-parser-key-event)
test_csdiff(diff-misc 24-shellcheck-line-content)

add_subdirectory(filter-file)
23 changes: 23 additions & 0 deletions tests/csdiff/diff-misc/24-shellcheck-line-content-add-z.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Error: SHELLCHECK_WARNING:
src/functions.sh:309:46: warning[SC2154]: GITHUB_REF is referenced but not assigned.
# 307| is_debug && local verbose=--verbose
# 308|
# 309|-> echo '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}' > payload.json
# 310|
# 311| local curl_args=(

Error: SHELLCHECK_WARNING:
src/functions.sh:309:129: info[SC2312]: Consider invoking this command separately to avoid masking its return value (or use '|| true' to ignore).
# 307| is_debug && local verbose=--verbose
# 308|
# 309|-> echo '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}' > payload.json
# 310|
# 311| local curl_args=(

Error: SHELLCHECK_WARNING:
src/functions.sh:309:152: info[SC2312]: Consider invoking this command separately to avoid masking its return value (or use '|| true' to ignore).
# 307| is_debug && local verbose=--verbose
# 308|
# 309|-> echo '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}' > payload.json
# 310|
# 311| local curl_args=(
23 changes: 23 additions & 0 deletions tests/csdiff/diff-misc/24-shellcheck-line-content-add.err
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Error: SHELLCHECK_WARNING:
src/functions.sh:309:46: warning[SC2154]: GITHUB_REF is referenced but not assigned.
# 307| is_debug && local verbose=--verbose
# 308|
# 309|-> echo '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}' > payload.json
# 310|
# 311| local curl_args=(

Error: SHELLCHECK_WARNING:
src/functions.sh:309:129: info[SC2312]: Consider invoking this command separately to avoid masking its return value (or use '|| true' to ignore).
# 307| is_debug && local verbose=--verbose
# 308|
# 309|-> echo '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}' > payload.json
# 310|
# 311| local curl_args=(

Error: SHELLCHECK_WARNING:
src/functions.sh:309:152: info[SC2312]: Consider invoking this command separately to avoid masking its return value (or use '|| true' to ignore).
# 307| is_debug && local verbose=--verbose
# 308|
# 309|-> echo '{"commit_oid":"'"${HEAD}"'","ref":"'"${GITHUB_REF//merge/head}"'","analysis_key":"differential-shellcheck","sarif":"'"$(gzip -c output.sarif | base64 -w0)"'","tool_names":["differential-shellcheck"]}' > payload.json
# 310|
# 311| local curl_args=(
Empty file.
Empty file.
Loading

0 comments on commit 9483a47

Please sign in to comment.