Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

55 řádky
1.1 KiB

  1. #!/usr/bin/env bats
  2. load test_helper
  3. export GIT_DIR="${PYENV_TEST_DIR}/.git"
  4. setup() {
  5. mkdir -p "$HOME"
  6. git config --global user.name "Tester"
  7. git config --global user.email "tester@test.local"
  8. cd "$PYENV_TEST_DIR"
  9. }
  10. git_commit() {
  11. git commit --quiet --allow-empty -m "empty"
  12. }
  13. @test "default version" {
  14. assert [ ! -e "$PYENV_ROOT" ]
  15. run pyenv---version
  16. assert_success
  17. [[ $output == "pyenv "?.?.* ]]
  18. }
  19. @test "doesn't read version from non-pyenv repo" {
  20. git init
  21. git remote add origin https://github.com/homebrew/homebrew.git
  22. git_commit
  23. git tag v1.0
  24. run pyenv---version
  25. assert_success
  26. [[ $output == "pyenv "?.?.* ]]
  27. }
  28. @test "reads version from git repo" {
  29. git init
  30. git remote add origin https://github.com/pyenv/pyenv.git
  31. git_commit
  32. git tag v0.4.1
  33. git_commit
  34. git_commit
  35. run pyenv---version
  36. assert_success "pyenv 0.4.1-2-g$(git rev-parse --short HEAD)"
  37. }
  38. @test "prints default version if no tags in git repo" {
  39. git init
  40. git remote add origin https://github.com/pyenv/pyenv.git
  41. git_commit
  42. run pyenv---version
  43. [[ $output == "pyenv "?.?.* ]]
  44. }