您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

55 行
1.1 KiB

10 年前
  1. #!/usr/bin/env bats
  2. load test_helper
  3. @test "blank invocation" {
  4. run pyenv
  5. assert_success
  6. assert [ "${lines[0]}" == "pyenv 20141012" ]
  7. }
  8. @test "invalid command" {
  9. run pyenv does-not-exist
  10. assert_failure
  11. assert_output "pyenv: no such command \`does-not-exist'"
  12. }
  13. @test "default PYENV_ROOT" {
  14. PYENV_ROOT="" HOME=/home/mislav run pyenv root
  15. assert_success
  16. assert_output "/home/mislav/.pyenv"
  17. }
  18. @test "inherited PYENV_ROOT" {
  19. PYENV_ROOT=/opt/pyenv run pyenv root
  20. assert_success
  21. assert_output "/opt/pyenv"
  22. }
  23. @test "default PYENV_DIR" {
  24. run pyenv echo PYENV_DIR
  25. assert_output "$(pwd)"
  26. }
  27. @test "inherited PYENV_DIR" {
  28. dir="${BATS_TMPDIR}/myproject"
  29. mkdir -p "$dir"
  30. PYENV_DIR="$dir" run pyenv echo PYENV_DIR
  31. assert_output "$dir"
  32. }
  33. @test "invalid PYENV_DIR" {
  34. dir="${BATS_TMPDIR}/does-not-exist"
  35. assert [ ! -d "$dir" ]
  36. PYENV_DIR="$dir" run pyenv echo PYENV_DIR
  37. assert_failure
  38. assert_output "pyenv: cannot change working directory to \`$dir'"
  39. }
  40. @test "conflicting GREP_OPTIONS" {
  41. file="${BATS_TMPDIR}/hello"
  42. echo "hello" > "$file"
  43. GREP_OPTIONS="-F" run pyenv grep "hell." "$file"
  44. assert_success
  45. assert_output "hello"
  46. }