mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 07:46:21 +02:00
tests: ensure nix-shell uses relative paths for expressions
This commit is contained in:
parent
04023360ed
commit
9a4641146f
1 changed files with 10 additions and 0 deletions
|
@ -59,6 +59,16 @@ chmod a+rx $TEST_ROOT/shell.shebang.sh
|
||||||
output=$($TEST_ROOT/shell.shebang.sh abc def)
|
output=$($TEST_ROOT/shell.shebang.sh abc def)
|
||||||
[ "$output" = "foo bar abc def" ]
|
[ "$output" = "foo bar abc def" ]
|
||||||
|
|
||||||
|
# Test nix-shell shebang mode with an alternate working directory
|
||||||
|
sed -e "s|@ENV_PROG@|$(type -P env)|" shell.shebang.expr > $TEST_ROOT/shell.shebang.expr
|
||||||
|
chmod a+rx $TEST_ROOT/shell.shebang.expr
|
||||||
|
# Should fail due to expressions using relative path
|
||||||
|
! $TEST_ROOT/shell.shebang.expr bar
|
||||||
|
cp shell.nix config.nix $TEST_ROOT
|
||||||
|
# Should succeed
|
||||||
|
output=$($TEST_ROOT/shell.shebang.expr bar)
|
||||||
|
[ "$output" = '-e load(ARGV.shift) -- '"$TEST_ROOT"'/shell.shebang.expr bar' ]
|
||||||
|
|
||||||
# Test nix-shell shebang mode again with metacharacters in the filename.
|
# Test nix-shell shebang mode again with metacharacters in the filename.
|
||||||
# First word of filename is chosen to not match any file in the test root.
|
# First word of filename is chosen to not match any file in the test root.
|
||||||
sed -e "s|@ENV_PROG@|$(type -P env)|" shell.shebang.sh > $TEST_ROOT/spaced\ \\\'\"shell.shebang.sh
|
sed -e "s|@ENV_PROG@|$(type -P env)|" shell.shebang.sh > $TEST_ROOT/spaced\ \\\'\"shell.shebang.sh
|
||||||
|
|
Loading…
Reference in a new issue