1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-18 00:03:45 -05:00

Import tests from rbenv with sed -e s/rbenv/pyenv/g

This commit is contained in:
Yamashita Yuu
2014-01-03 01:48:22 +09:00
parent f538169992
commit 0965577b93
26 changed files with 1574 additions and 0 deletions

46
test/--version.bats Normal file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bats
load test_helper
setup() {
mkdir -p "$HOME"
git config --global user.name "Tester"
git config --global user.email "tester@test.local"
}
git_commit() {
git commit --quiet --allow-empty -m "empty"
}
@test "default version" {
assert [ ! -e "$PYENV_ROOT" ]
run pyenv---version
assert_success
[[ $output == "pyenv 0."* ]]
}
@test "reads version from git repo" {
mkdir -p "$PYENV_ROOT"
cd "$PYENV_ROOT"
git init
git_commit
git tag v0.4.1
git_commit
git_commit
cd "$PYENV_TEST_DIR"
run pyenv---version
assert_success
[[ $output == "pyenv 0.4.1-2-g"* ]]
}
@test "prints default version if no tags in git repo" {
mkdir -p "$PYENV_ROOT"
cd "$PYENV_ROOT"
git init
git_commit
cd "$PYENV_TEST_DIR"
run pyenv---version
[[ $output == "pyenv 0."* ]]
}