summaryrefslogtreecommitdiff
path: root/tests/setup_devd_test
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-12 12:01:36 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-12 12:01:36 +0200
commit14479d66c893f72a6e8313cdca1b3269b2418bc3 (patch)
tree9a1fa4319a8ccc73005355ba8bb25afc8e39b148 /tests/setup_devd_test
parent654cbd2971de0d3e18b7610d3e7b3bd025348d5b (diff)
downloadalpine-conf-14479d66c893f72a6e8313cdca1b3269b2418bc3.zip
tests: refactor to de-duplicate code
Have a shared test_env.sh to de-duplicate code. Add a common test_usage, where we test that: - option -h prints to stdout and exit with success - invalid option prints usage to stderr and exit with error Use a common init_tests and a common atf_init_test_cases Move documenation links to README.md
Diffstat (limited to 'tests/setup_devd_test')
-rwxr-xr-xtests/setup_devd_test22
1 files changed, 4 insertions, 18 deletions
diff --git a/tests/setup_devd_test b/tests/setup_devd_test
index d911314..60e84b3 100755
--- a/tests/setup_devd_test
+++ b/tests/setup_devd_test
@@ -1,24 +1,10 @@
#!/usr/bin/env atf-sh
-init_env() {
- PATH=$(atf_get_srcdir)/..:$PATH
- export ROOT=$PWD LIBDIR=$(atf_get_srcdir)/.. MOCK=echo
-}
-
-# docs:
-# - https://github.com/jmmv/kyua/wiki/Quickstart-atf-sh-test
-# - https://manned.org/atf-sh-api
-
-atf_init_test_cases() {
- atf_add_test_case setup_devd_usage
-}
+. $(atf_get_srcdir)/test_env.sh
+init_tests \
+ setup_devd_usage
-atf_test_case setup_devd_usage
setup_devd_usage_body() {
- init_env
- atf_check -s exit:0 \
- -o match:'^usage: setup-devd' \
- -e empty \
- setup-devd -h
+ test_usage setup-devd
}