about summary refs log tree commit diff
path: root/tests/nix-shell.sh
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2018-04-08T04·45-0400
committerSamuel Dionne-Riel <samuel@dionne-riel.com>2018-04-08T04·45-0400
commit9478f886810b8db87b7ebfe14343f77159c86a24 (patch)
tree9ffff18948b25ac7149589dcac4e131c58492f9e /tests/nix-shell.sh
parent399f43c3d5fe91db3a2d6968d8ec30a4d6fbf285 (diff)
Adds `nix-shell` test for special-cased ruby interpreter.
The test fakes the interpreter only to verify the arguments it would be
given.
Diffstat (limited to 'tests/nix-shell.sh')
-rw-r--r--tests/nix-shell.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/nix-shell.sh b/tests/nix-shell.sh
index 063e97ce2c75..7f14b6c31db6 100644
--- a/tests/nix-shell.sh
+++ b/tests/nix-shell.sh
@@ -39,3 +39,12 @@ chmod a+rx $TEST_ROOT/shell.shebang.sh
 
 output=$($TEST_ROOT/shell.shebang.sh abc def)
 [ "$output" = "foo bar abc def" ]
+
+# Test nix-shell shebang mode for ruby
+# This uses a fake interpreter that returns the arguments passed
+# This, in turn, verifies the `rc` script is valid and the `load()` script (given using `-e`) is as expected.
+sed -e "s|@ENV_PROG@|$(type -p env)|" shell.shebang.rb > $TEST_ROOT/shell.shebang.rb
+chmod a+rx $TEST_ROOT/shell.shebang.rb
+
+output=$($TEST_ROOT/shell.shebang.rb abc ruby)
+[ "$output" = '-e load("'"$TEST_ROOT"'/shell.shebang.rb") -- abc ruby' ]