test that IFS in hooks is correct

closes #379
This commit is contained in:
Mislav Marohnić 2013-04-16 14:01:04 +02:00
parent 6ca591ab75
commit 060f141b21
3 changed files with 42 additions and 0 deletions

View file

@ -45,6 +45,20 @@ OUT
assert_line "HELLO=from hook"
}
@test "carries original IFS within hooks" {
hook_path="${RBENV_TEST_DIR}/rbenv.d"
mkdir -p "${hook_path}/exec"
cat > "${hook_path}/exec/hello.bash" <<SH
hellos=(\$(printf "hello\\tugly world\\nagain"))
echo HELLO="\$(printf ":%s" "\${hellos[@]}")"
SH
export RBENV_VERSION=system
RBENV_HOOK_PATH="$hook_path" IFS=$' \t\n' run rbenv-exec env
assert_success
assert_line "HELLO=:hello:ugly:world:again"
}
@test "forwards all arguments" {
export RBENV_VERSION="2.0"
create_executable "ruby" <<SH

View file

@ -52,3 +52,17 @@ rspec
ruby
OUT
}
@test "carries original IFS within hooks" {
hook_path="${RBENV_TEST_DIR}/rbenv.d"
mkdir -p "${hook_path}/rehash"
cat > "${hook_path}/rehash/hello.bash" <<SH
hellos=(\$(printf "hello\\tugly world\\nagain"))
echo HELLO="\$(printf ":%s" "\${hellos[@]}")"
exit
SH
RBENV_HOOK_PATH="$hook_path" IFS=$' \t\n' run rbenv-rehash
assert_success
assert_output "HELLO=:hello:ugly:world:again"
}

View file

@ -58,3 +58,17 @@ The \`rspec' command exists in these Ruby versions:
2.0
OUT
}
@test "carries original IFS within hooks" {
hook_path="${RBENV_TEST_DIR}/rbenv.d"
mkdir -p "${hook_path}/which"
cat > "${hook_path}/which/hello.bash" <<SH
hellos=(\$(printf "hello\\tugly world\\nagain"))
echo HELLO="\$(printf ":%s" "\${hellos[@]}")"
exit
SH
RBENV_HOOK_PATH="$hook_path" IFS=$' \t\n' run rbenv-which anything
assert_success
assert_output "HELLO=:hello:ugly:world:again"
}