mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 03:56:01 +01:00
shellcheck fix: tests/functional/flakes/run.sh
This commit is contained in:
parent
020f67a653
commit
cb22518754
2 changed files with 10 additions and 11 deletions
|
|
@ -106,7 +106,6 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
excludes = [
|
excludes = [
|
||||||
# We haven't linted these files yet
|
# We haven't linted these files yet
|
||||||
''^tests/functional/flakes/run\.sh$''
|
|
||||||
''^tests/functional/flakes/show\.sh$''
|
''^tests/functional/flakes/show\.sh$''
|
||||||
''^tests/functional/formatter\.sh$''
|
''^tests/functional/formatter\.sh$''
|
||||||
''^tests/functional/formatter\.simple\.sh$''
|
''^tests/functional/formatter\.simple\.sh$''
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ source ../common.sh
|
||||||
TODO_NixOS
|
TODO_NixOS
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
rm -rf $TEST_HOME/.cache $TEST_HOME/.config $TEST_HOME/.local
|
rm -rf "$TEST_HOME"/.cache "$TEST_HOME"/.config "$TEST_HOME"/.local
|
||||||
|
|
||||||
cp ../shell-hello.nix "${config_nix}" $TEST_HOME
|
cp ../shell-hello.nix "${config_nix}" "$TEST_HOME"
|
||||||
cd $TEST_HOME
|
cd "$TEST_HOME"
|
||||||
|
|
||||||
cat <<EOF > flake.nix
|
cat <<EOF > flake.nix
|
||||||
{
|
{
|
||||||
|
|
@ -34,8 +34,8 @@ nix run --no-write-lock-file .#pkgAsPkg
|
||||||
# For instance, we might set an environment variable temporarily to affect some
|
# For instance, we might set an environment variable temporarily to affect some
|
||||||
# initialization or whatnot, but this must not leak into the environment of the
|
# initialization or whatnot, but this must not leak into the environment of the
|
||||||
# command being run.
|
# command being run.
|
||||||
env > $TEST_ROOT/expected-env
|
env > "$TEST_ROOT"/expected-env
|
||||||
nix run -f shell-hello.nix env > $TEST_ROOT/actual-env
|
nix run -f shell-hello.nix env > "$TEST_ROOT"/actual-env
|
||||||
# Remove/reset variables we expect to be different.
|
# Remove/reset variables we expect to be different.
|
||||||
# - PATH is modified by nix shell
|
# - PATH is modified by nix shell
|
||||||
# - we unset TMPDIR on macOS if it contains /var/folders. bad. https://github.com/NixOS/nix/issues/7731
|
# - we unset TMPDIR on macOS if it contains /var/folders. bad. https://github.com/NixOS/nix/issues/7731
|
||||||
|
|
@ -48,12 +48,12 @@ sed -i \
|
||||||
-e '/^TMPDIR=\/var\/folders\/.*/d' \
|
-e '/^TMPDIR=\/var\/folders\/.*/d' \
|
||||||
-e '/^__CF_USER_TEXT_ENCODING=.*$/d' \
|
-e '/^__CF_USER_TEXT_ENCODING=.*$/d' \
|
||||||
-e '/^__LLVM_PROFILE_RT_INIT_ONCE=.*$/d' \
|
-e '/^__LLVM_PROFILE_RT_INIT_ONCE=.*$/d' \
|
||||||
$TEST_ROOT/expected-env $TEST_ROOT/actual-env
|
"$TEST_ROOT"/expected-env "$TEST_ROOT"/actual-env
|
||||||
sort $TEST_ROOT/expected-env | uniq > $TEST_ROOT/expected-env.sorted
|
sort "$TEST_ROOT"/expected-env | uniq > "$TEST_ROOT"/expected-env.sorted
|
||||||
# nix run appears to clear _. I don't understand why. Is this ok?
|
# nix run appears to clear _. I don't understand why. Is this ok?
|
||||||
echo "_=..." >> $TEST_ROOT/actual-env
|
echo "_=..." >> "$TEST_ROOT"/actual-env
|
||||||
sort $TEST_ROOT/actual-env | uniq > $TEST_ROOT/actual-env.sorted
|
sort "$TEST_ROOT"/actual-env | uniq > "$TEST_ROOT"/actual-env.sorted
|
||||||
diff $TEST_ROOT/expected-env.sorted $TEST_ROOT/actual-env.sorted
|
diff "$TEST_ROOT"/expected-env.sorted "$TEST_ROOT"/actual-env.sorted
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue