aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/shell.shebang.nix
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 05:06:32 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 05:06:32 +0100
commit032eff7f6919daf8c4065ccdba776f23f1701174 (patch)
tree003fb20a6fe261cac5f4bd3d02045015c9332583 /tests/functional/shell.shebang.nix
parent7f590ea7096d1e1bbbe73697358fef962d0fb494 (diff)
Merge pull request #8470 from ncfavier/shebang-single-quotes
nix-shell: support single quotes in shebangs, fix whitespace parsing (cherry picked from commit 3b99c6291377cbd22607896af9dfafa857d2f2dc) Change-Id: I2a431b21c3467eefa1ef95d5a36d672f45b6937a
Diffstat (limited to 'tests/functional/shell.shebang.nix')
-rwxr-xr-xtests/functional/shell.shebang.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/functional/shell.shebang.nix b/tests/functional/shell.shebang.nix
new file mode 100755
index 000000000..08e43d53c
--- /dev/null
+++ b/tests/functional/shell.shebang.nix
@@ -0,0 +1,10 @@
+#! @ENV_PROG@ nix-shell
+#! nix-shell -I nixpkgs=shell.nix --no-substitute
+#! nix-shell --argstr s1 'foo "bar" \baz'"'"'qux' --argstr s2 "foo 'bar' \"\baz" --argstr s3 \foo\ bar\'baz --argstr s4 ''
+#! nix-shell shell.shebang.nix --command true
+{ s1, s2, s3, s4 }:
+assert s1 == ''foo "bar" \baz'qux'';
+assert s2 == "foo 'bar' \"baz";
+assert s3 == "foo bar'baz";
+assert s4 == "";
+(import <nixpkgs> {}).runCommand "nix-shell" {} ""