1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-16 07:13:53 -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

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bats
load test_helper
setup() {
mkdir -p "$PYENV_TEST_DIR"
cd "$PYENV_TEST_DIR"
}
@test "invocation without 2 arguments prints usage" {
run pyenv-version-file-write
assert_failure "Usage: pyenv version-file-write <file> <version>"
run pyenv-version-file-write "one" ""
assert_failure
}
@test "setting nonexistent version fails" {
assert [ ! -e ".python-version" ]
run pyenv-version-file-write ".python-version" "1.8.7"
assert_failure "pyenv: version \`1.8.7' not installed"
assert [ ! -e ".python-version" ]
}
@test "writes value to arbitrary file" {
mkdir -p "${PYENV_ROOT}/versions/1.8.7"
assert [ ! -e "my-version" ]
run pyenv-version-file-write "${PWD}/my-version" "1.8.7"
assert_success ""
assert [ "$(cat my-version)" = "1.8.7" ]
}