Просмотр исходного кода

test that IFS in hooks is correct

closes #379
pull/360/head^2
Mislav Marohnić 13 лет назад
Родитель
Сommit
060f141b21
3 измененных файлов: 42 добавлений и 0 удалений
  1. +14
    -0
      test/exec.bats
  2. +14
    -0
      test/rehash.bats
  3. +14
    -0
      test/which.bats

+ 14
- 0
test/exec.bats Просмотреть файл

@ -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

+ 14
- 0
test/rehash.bats Просмотреть файл

@ -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"
}

+ 14
- 0
test/which.bats Просмотреть файл

@ -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"
}

Загрузка…
Отмена
Сохранить