logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: 1691a635e66f4cfeab54e893b4ef220a64b03002
parent f9d1066e60f0bd6323bc2ae06c37de4b843406b7
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 11 Feb 2022 20:58:15 +0100

bin/pwd: Handle unknown arg

Diffstat:

Mbin/pwd.c1+
Mtest-bin/pwd7+++++++
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/bin/pwd.c b/bin/pwd.c @@ -20,6 +20,7 @@ main(int argc, char *argv[]) if(argc != 1) { usage(argv[0]); + return 1; } if(getcwd(pwd, sizeof(pwd)) == NULL) diff --git a/test-bin/pwd b/test-bin/pwd @@ -4,7 +4,14 @@ simple_body() { atf_check -o "inline:${PWD}\n" ../bin/pwd } +atf_test_case args +args_body() { + atf_check -s exit:1 -o "inline:usage: ../bin/pwd\n" ../bin/pwd -H +} + + atf_init_test_cases() { cd "$(atf_get_srcdir)" atf_add_test_case simple + atf_add_test_case args }