test/system: Silence SC2088

Otherwise https://www.shellcheck.net/ would complain:
  Line 141:
  assert_line --index 0 "~/.bash_profile read"
                        ^------------------^ SC2088 (warning): Tilde
                                             does not expand in quotes.
                                             Use $HOME.

See: https://www.shellcheck.net/wiki/SC2088

This is a false positive.  There's no need for the tilde to be expanded
because it's not being used for any file system operation.  It's merely
a human-readable string.

However, it's easier to change the string to use $HOME than littering
the file with ShellCheck's inline 'disable' directives.

https://github.com/containers/toolbox/pull/1366
This commit is contained in:
Debarshi Ray 2023-07-07 18:14:01 +02:00
parent d6bcbc49dd
commit 6589bdd779

View file

@ -131,14 +131,14 @@ teardown() {
create_default_container create_default_container
cp "$HOME"/.bash_profile "$HOME"/.bash_profile.orig cp "$HOME"/.bash_profile "$HOME"/.bash_profile.orig
echo "echo \"~/.bash_profile read\"" >>"$HOME"/.bash_profile echo "echo \"$HOME/.bash_profile read\"" >>"$HOME"/.bash_profile
run "$TOOLBOX" run true run "$TOOLBOX" run true
mv "$HOME"/.bash_profile.orig "$HOME"/.bash_profile mv "$HOME"/.bash_profile.orig "$HOME"/.bash_profile
assert_success assert_success
assert_line --index 0 "~/.bash_profile read" assert_line --index 0 "$HOME/.bash_profile read"
assert [ ${#lines[@]} -eq 1 ] assert [ ${#lines[@]} -eq 1 ]
} }