diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 15:15:22 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2022-05-12 15:15:55 +0200 |
commit | 8abc3684817d95956c2a7e0f2c31b7b4add8661e (patch) | |
tree | 3d6ec26baab4e00f610d62dacaed86259f5a5568 /tests/test_env.sh | |
parent | fec2da9a79319825ae1a28af0304341717d5d0fd (diff) | |
download | alpine-conf-8abc3684817d95956c2a7e0f2c31b7b4add8661e.zip |
tests: add the missing test_env.sh
it was missed due to the *.sh in .gitignore
Diffstat (limited to 'tests/test_env.sh')
-rw-r--r-- | tests/test_env.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_env.sh b/tests/test_env.sh new file mode 100644 index 0000000..6fa3da1 --- /dev/null +++ b/tests/test_env.sh @@ -0,0 +1,34 @@ +PATH=$(atf_get_srcdir)/..:$PATH + +init_env() { + export ROOT=$PWD LIBDIR=$(atf_get_srcdir)/.. MOCK=echo +} + +init_tests() { + TESTS="$@" + export TESTS + for t; do + atf_test_case $t + done +} + +atf_init_test_cases() { + for t in $TESTS; do + atf_add_test_case $t + done +} + +test_usage() { + local prog="$1" + init_env + atf_check -s exit:0 \ + -o match:"^usage: $prog" \ + -e empty \ + $prog -h + + atf_check -s exit:1 \ + -o empty \ + -e match:"^usage: $prog" \ + $prog -INVALID +} + |