un-indent shebang for test executables

This commit is contained in:
Mislav Marohnić 2013-04-02 02:48:04 +02:00
parent 97290b2442
commit f6db678b20

View file

@ -3,10 +3,15 @@
load test_helper load test_helper
create_executable() { create_executable() {
name="${1?}"
shift 1
bin="${RBENV_ROOT}/versions/${RBENV_VERSION}/bin" bin="${RBENV_ROOT}/versions/${RBENV_VERSION}/bin"
mkdir -p "$bin" mkdir -p "$bin"
echo "$2" > "${bin}/$1" { if [ $# -eq 0 ]; then cat -
chmod +x "${bin}/$1" else echo "$@"
fi
} | sed -Ee '1s/^ +//' > "${bin}/$name"
chmod +x "${bin}/$name"
} }
@test "fails with invalid version" { @test "fails with invalid version" {
@ -17,8 +22,8 @@ create_executable() {
@test "completes with names of executables" { @test "completes with names of executables" {
export RBENV_VERSION="2.0" export RBENV_VERSION="2.0"
create_executable "ruby" create_executable "ruby" "#!/bin/sh"
create_executable "rake" create_executable "rake" "#!/bin/sh"
rbenv-rehash rbenv-rehash
run rbenv-completions exec run rbenv-completions exec
@ -40,12 +45,14 @@ create_executable() {
@test "forwards all arguments" { @test "forwards all arguments" {
export RBENV_VERSION="2.0" export RBENV_VERSION="2.0"
create_executable "ruby" "#!$BASH create_executable "ruby" <<SH
echo \$0 #!$BASH
for arg; do echo \$0
# hack to avoid bash builtin echo which can't output '-e' for arg; do
printf \"%s\\n\" \"\$arg\" # hack to avoid bash builtin echo which can't output '-e'
done" printf "%s\\n" "\$arg"
done
SH
run rbenv-exec ruby -w -e "puts 'hello world'" -- extra args run rbenv-exec ruby -w -e "puts 'hello world'" -- extra args
assert_success "\ assert_success "\