logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: dfa239ea7f66e04e3b5018c49cf546549fb456a2
parent 43957cf80d6aa56acd7357f585527603509db482
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 14 Feb 2022 21:54:11 +0100

test-bin/pwd: Add case on removed cwd

Diffstat:

Mtest-bin/pwd12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/test-bin/pwd b/test-bin/pwd @@ -9,9 +9,21 @@ args_body() { atf_check -s exit:1 -o "inline:usage: ../bin/pwd\n" ../bin/pwd -H } +atf_test_case enoent cleanup +enoent_body() { + mkdir -p "$(atf_get_srcdir)/remove-me" || exit 1 + cd "$(atf_get_srcdir)/remove-me" || exit 1 + rm -fr "$(atf_get_srcdir)/remove-me" || exit 1 + + atf_check -s exit:1 -e 'inline:getcwd: No such file or directory\n' ../../bin/pwd +} +enoent_cleanup() { + rm -fr "$(atf_get_srcdir)/remove-me" +} atf_init_test_cases() { cd "$(atf_get_srcdir)" || exit 1 atf_add_test_case simple atf_add_test_case args + atf_add_test_case enoent }