lib/tests: Quote variable references

This commit is contained in:
Victor Engmark 2021-11-26 09:36:42 +13:00
parent 6d53055cb7
commit 40d1c87bea

View file

@ -11,7 +11,7 @@ die() {
if test -n "${TEST_LIB:-}"; then if test -n "${TEST_LIB:-}"; then
NIX_PATH=nixpkgs="$(dirname "$TEST_LIB")" NIX_PATH=nixpkgs="$(dirname "$TEST_LIB")"
else else
NIX_PATH=nixpkgs="$(cd $(dirname ${BASH_SOURCE[0]})/../..; pwd)" NIX_PATH=nixpkgs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.."; pwd)"
fi fi
export NIX_PATH export NIX_PATH
@ -20,7 +20,7 @@ clean_up() {
rm -rf "$work" rm -rf "$work"
} }
trap clean_up EXIT trap clean_up EXIT
cd $work cd "$work"
touch {README.md,module.o,foo.bar} touch {README.md,module.o,foo.bar}
@ -30,7 +30,7 @@ touch {README.md,module.o,foo.bar}
dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${ dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
cleanSource ./. cleanSource ./.
}")')" }")')"
(cd $dir; find) | sort -f | diff -U10 - <(cat <<EOF (cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
. .
./foo.bar ./foo.bar
./README.md ./README.md
@ -41,7 +41,7 @@ EOF
dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${ dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
cleanSourceWith { src = '"$work"'; filter = path: type: ! hasSuffix ".bar" path; } cleanSourceWith { src = '"$work"'; filter = path: type: ! hasSuffix ".bar" path; }
}")')" }")')"
(cd $dir; find) | sort -f | diff -U10 - <(cat <<EOF (cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
. .
./module.o ./module.o
./README.md ./README.md
@ -51,7 +51,7 @@ EOF
dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${ dir="$(nix eval --impure --raw --expr '(with import <nixpkgs/lib>; "${
cleanSourceWith { src = cleanSource '"$work"'; filter = path: type: ! hasSuffix ".bar" path; } cleanSourceWith { src = cleanSource '"$work"'; filter = path: type: ! hasSuffix ".bar" path; }
}")')" }")')"
(cd $dir; find) | sort -f | diff -U10 - <(cat <<EOF (cd "$dir"; find) | sort -f | diff -U10 - <(cat <<EOF
. .
./README.md ./README.md
EOF EOF