Some checks are pending
macos_build / macos_build (3.10) (push) Waiting to run
macos_build / macos_build (3.11) (push) Waiting to run
macos_build / macos_build (3.12) (push) Waiting to run
macos_build / macos_build (3.13) (push) Waiting to run
macos_build / macos_build (3.14) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-14) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-15) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-15-intel) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-26) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-22.04) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-24.04) (push) Waiting to run
ubuntu_build / ubuntu_build (3.10) (push) Waiting to run
ubuntu_build / ubuntu_build (3.11) (push) Waiting to run
ubuntu_build / ubuntu_build (3.12) (push) Waiting to run
ubuntu_build / ubuntu_build (3.13) (push) Waiting to run
ubuntu_build / ubuntu_build (3.14) (push) Waiting to run
52 lines
880 B
Bash
52 lines
880 B
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
create_command() {
|
|
bin="${PYENV_TEST_DIR}/bin"
|
|
mkdir -p "$bin"
|
|
echo "$2" > "${bin}/$1"
|
|
chmod +x "${bin}/$1"
|
|
}
|
|
|
|
@test "command with no completion support" {
|
|
create_command "pyenv-hello" "#!$BASH
|
|
echo hello"
|
|
run pyenv-completions hello
|
|
assert_success "--help"
|
|
}
|
|
|
|
@test "command with completion support" {
|
|
create_command "pyenv-hello" "#!$BASH
|
|
# Provide pyenv completions
|
|
if [[ \$1 = --complete ]]; then
|
|
echo hello
|
|
else
|
|
exit 1
|
|
fi"
|
|
run pyenv-completions hello
|
|
assert_success
|
|
assert_output <<OUT
|
|
--help
|
|
hello
|
|
OUT
|
|
}
|
|
|
|
@test "forwards extra arguments" {
|
|
create_command "pyenv-hello" "#!$BASH
|
|
# provide pyenv completions
|
|
if [[ \$1 = --complete ]]; then
|
|
shift 1
|
|
for arg; do echo \$arg; done
|
|
else
|
|
exit 1
|
|
fi"
|
|
run pyenv-completions hello happy world
|
|
assert_success
|
|
assert_output <<OUT
|
|
--help
|
|
happy
|
|
world
|
|
OUT
|
|
}
|