You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 regels
817 B

  1. #!/usr/bin/env bats
  2. load test_helper
  3. setup() {
  4. mkdir -p "$HOME"
  5. git config --global user.name "Tester"
  6. git config --global user.email "tester@test.local"
  7. }
  8. git_commit() {
  9. git commit --quiet --allow-empty -m "empty"
  10. }
  11. @test "default version" {
  12. assert [ ! -e "$PYENV_ROOT" ]
  13. run pyenv---version
  14. assert_success
  15. [[ $output == "pyenv 0."* ]]
  16. }
  17. @test "reads version from git repo" {
  18. mkdir -p "$PYENV_ROOT"
  19. cd "$PYENV_ROOT"
  20. git init
  21. git_commit
  22. git tag v0.4.1
  23. git_commit
  24. git_commit
  25. cd "$PYENV_TEST_DIR"
  26. run pyenv---version
  27. assert_success
  28. [[ $output == "pyenv 0.4.1-2-g"* ]]
  29. }
  30. @test "prints default version if no tags in git repo" {
  31. mkdir -p "$PYENV_ROOT"
  32. cd "$PYENV_ROOT"
  33. git init
  34. git_commit
  35. cd "$PYENV_TEST_DIR"
  36. run pyenv---version
  37. [[ $output == "pyenv 0."* ]]
  38. }