mirror of
https://github.com/NixOS/nix.git
synced 2025-11-08 19:46:02 +01:00
shellcheck fix: tests/functional/pure-eval.sh
This commit is contained in:
parent
bcd8311ec6
commit
b951e6e1ed
1 changed files with 8 additions and 6 deletions
|
|
@ -10,6 +10,7 @@ nix eval --expr 'assert 1 + 2 == 3; true'
|
|||
|
||||
missingImpureErrorMsg=$(! nix eval --expr 'builtins.readFile ./pure-eval.sh' 2>&1)
|
||||
|
||||
# shellcheck disable=SC1111
|
||||
echo "$missingImpureErrorMsg" | grepQuiet -- --impure || \
|
||||
fail "The error message should mention the “--impure” flag to unblock users"
|
||||
|
||||
|
|
@ -25,14 +26,15 @@ echo "$missingImpureErrorMsg" | grepQuiet -- --impure || \
|
|||
(! nix eval --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; })).x")
|
||||
nix eval --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; sha256 = \"$(nix hash file pure-eval.nix --type sha256)\"; })).x"
|
||||
|
||||
rm -rf $TEST_ROOT/eval-out
|
||||
nix eval --store dummy:// --write-to $TEST_ROOT/eval-out --expr '{ x = "foo" + "bar"; y = { z = "bla"; }; }'
|
||||
[[ $(cat $TEST_ROOT/eval-out/x) = foobar ]]
|
||||
[[ $(cat $TEST_ROOT/eval-out/y/z) = bla ]]
|
||||
rm -rf "$TEST_ROOT"/eval-out
|
||||
nix eval --store dummy:// --write-to "$TEST_ROOT"/eval-out --expr '{ x = "foo" + "bar"; y = { z = "bla"; }; }'
|
||||
[[ $(cat "$TEST_ROOT"/eval-out/x) = foobar ]]
|
||||
[[ $(cat "$TEST_ROOT"/eval-out/y/z) = bla ]]
|
||||
|
||||
rm -rf $TEST_ROOT/eval-out
|
||||
(! nix eval --store dummy:// --write-to $TEST_ROOT/eval-out --expr '{ "." = "bla"; }')
|
||||
rm -rf "$TEST_ROOT"/eval-out
|
||||
(! nix eval --store dummy:// --write-to "$TEST_ROOT"/eval-out --expr '{ "." = "bla"; }')
|
||||
|
||||
# shellcheck disable=SC2088
|
||||
(! nix eval --expr '~/foo')
|
||||
|
||||
expectStderr 0 nix eval --expr "/some/absolute/path" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue