1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-10 12:33:48 -05:00

Import changes from ruby-build v20150112

This commit is contained in:
Yamashita Yuu
2015-01-15 23:13:36 +09:00
parent ba9c01ce77
commit 123b3af1a0
8 changed files with 135 additions and 32 deletions

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bats
load test_helper
@test "not enought arguments for python-build" {
# use empty inline definition so nothing gets built anyway
local definition="${TMP}/build-definition"
echo '' > "$definition"
run python-build "$definition"
assert_failure
assert_output_contains 'Usage: python-build'
}
@test "extra arguments for python-build" {
# use empty inline definition so nothing gets built anyway
local definition="${TMP}/build-definition"
echo '' > "$definition"
run python-build "$definition" "${TMP}/install" ""
assert_failure
assert_output_contains 'Usage: python-build'
}

View File

@@ -5,6 +5,7 @@ export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
export MAKE=make
export MAKE_OPTS="-j 2"
export CC=cc
export -n PYTHON_CONFIGURE_OPTS
setup() {
mkdir -p "$INSTALL_ROOT"
@@ -449,6 +450,18 @@ OUT
# nop
}
@test "JRuby Java 7 missing" {
# nop
}
@test "JRuby Java is outdated" {
# nop
}
@test "JRuby Java 7 up-to-date" {
# nop
}
@test "non-writable TMPDIR aborts build" {
export TMPDIR="${TMP}/build"
mkdir -p "$TMPDIR"

View File

@@ -5,8 +5,13 @@ export MAKE=make
export MAKE_OPTS='-j 2'
export -n CFLAGS
export -n CC
export -n PYTHON_CONFIGURE_OPTS
@test "require_gcc on OS X 10.9" {
# yyuu/pyenv#222
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5'
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5'
stub gcc '--version : echo 4.2.1'
@@ -24,6 +29,10 @@ OUT
}
@test "require_gcc on OS X 10.10" {
# yyuu/pyenv#222
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
stub gcc '--version : echo 4.2.1'
@@ -36,7 +45,7 @@ DEF
assert_success
assert_output <<OUT
CC=${TMP}/bin/gcc
MACOSX_DEPLOYMENT_TARGET=10.10
MACOSX_DEPLOYMENT_TARGET=10.9
OUT
}

View File

@@ -146,3 +146,42 @@ ${PYENV_ROOT}/plugins/bar/share/python-build
${PYENV_ROOT}/plugins/foo/share/python-build
OUT
}
@test "not enough arguments for pyenv-install" {
stub_python_build
run pyenv-install
assert_failure
assert_output_contains 'Usage: pyenv install'
}
@test "too many arguments for pyenv-install" {
stub_python_build
run pyenv-install 3.4.1 3.4.2
assert_failure
assert_output_contains 'Usage: pyenv install'
}
@test "show help for pyenv-install" {
stub_python_build
run pyenv-install -h
assert_success
assert_output_contains 'Usage: pyenv install'
}
@test "not enough arguments pyenv-uninstall" {
run pyenv-uninstall
assert_failure
assert_output_contains 'Usage: pyenv uninstall'
}
@test "too many arguments for pyenv-uninstall" {
run pyenv-uninstall 3.4.1 3.4.2
assert_failure
assert_output_contains 'Usage: pyenv uninstall'
}
@test "show help for pyenv-uninstall" {
run pyenv-uninstall -h
assert_success
assert_output_contains 'Usage: pyenv uninstall'
}

View File

@@ -115,6 +115,10 @@ assert_output() {
assert_output_contains() {
local expected="$1"
if [ -z "$expected" ]; then
echo "assert_output_contains needs an argument" >&2
return 1
fi
echo "$output" | $(type -p ggrep grep | head -1) -F "$expected" >/dev/null || {
{ echo "expected output to contain $expected"
echo "actual: $output"