From 438e828eb507536eebe42adee3e896bceb165d8c Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Tue, 22 Sep 2015 15:28:00 +0900 Subject: [PATCH] add tests for `PYENV_FILE_ARG` --- test/pyenv_ext.bats | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/pyenv_ext.bats b/test/pyenv_ext.bats index cc138cbe..fdae87fc 100644 --- a/test/pyenv_ext.bats +++ b/test/pyenv_ext.bats @@ -12,3 +12,19 @@ load test_helper PYENV_VERSION="2.7.10:system" run pyenv-prefix assert_success "${PYENV_ROOT}/versions/2.7.10:${PYENV_TEST_DIR}" } + +@test "should use dirname of file argument as PYENV_DIR" { + mkdir -p "${PYENV_TEST_DIR}/dir1" + touch "${PYENV_TEST_DIR}/dir1/file.py" + PYENV_FILE_ARG="${PYENV_TEST_DIR}/dir1/file.py" run pyenv echo PYENV_DIR + assert_output "${PYENV_TEST_DIR}/dir1" +} + +@test "should follow symlink of file argument (#379, #404)" { + mkdir -p "${PYENV_TEST_DIR}/dir1" + mkdir -p "${PYENV_TEST_DIR}/dir2" + touch "${PYENV_TEST_DIR}/dir1/file.py" + ln -s "${PYENV_TEST_DIR}/dir1/file.py" "${PYENV_TEST_DIR}/dir2/symlink.py" + PYENV_FILE_ARG="${PYENV_TEST_DIR}/dir2/symlink.py" run pyenv echo PYENV_DIR + assert_output "${PYENV_TEST_DIR}/dir1" +}