1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 14:21:48 +02:00

Fix and extend nix-shell baseDir test

This commit is contained in:
Robert Hensing 2024-07-07 00:22:21 +02:00
parent d5854f33e2
commit f5b59fbc64
6 changed files with 20 additions and 2 deletions

View file

@ -72,8 +72,9 @@ chmod a+rx $TEST_ROOT/shell.shebang.expr
! $TEST_ROOT/shell.shebang.expr bar
cp shell.nix config.nix $TEST_ROOT
# Should succeed
echo "cwd: $PWD"
output=$($TEST_ROOT/shell.shebang.expr bar)
[ "$output" = '-e load(ARGV.shift) -- '"$TEST_ROOT"'/shell.shebang.expr bar' ]
[ "$output" = foo ]
# 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.

View file

@ -43,6 +43,7 @@ let pkgs = rec {
ASCII_PERCENT = "%";
ASCII_AT = "@";
TEST_inNixShell = if inNixShell then "true" else "false";
FOO = fooContents;
inherit stdenv;
outputs = ["dev" "out"];
} // {

View file

@ -0,0 +1,9 @@
#! @ENV_PROG@ nix-shell
#! nix-shell "{ script, path, ... }: assert path == ./shell.nix; script { }"
#! nix-shell --no-substitute
#! nix-shell --expr
#! nix-shell --arg script "import ./shell.nix"
#! nix-shell --arg path "./shell.nix"
#! nix-shell -A shellDrv
#! nix-shell -i bash
echo "$FOO"