dirname (892B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- atf_test_case noargs
- noargs_body() {
- atf_check -e "inline:usage: dirname string\n" -s exit:1 ../cmd/dirname
- }
- atf_test_case one_slash
- one_slash_body() {
- atf_check -o "inline:/usr\n" ../cmd/dirname "/usr/bin"
- }
- atf_test_case two_slash
- two_slash_body() {
- atf_check -o "inline:/usr\n" ../cmd/dirname "/usr//bin"
- }
- atf_test_case two_dash
- two_dash_body() {
- atf_check -o "inline:/usr\n" ../cmd/dirname -- "/usr//bin"
- }
- atf_test_case badarg
- badarg_body() {
- atf_check -s exit:1 -e "inline:usage: dirname string\n" ../cmd/dirname -a "/usr//bin"
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- atf_add_test_case noargs
- atf_add_test_case badarg
- atf_add_test_case one_slash
- atf_add_test_case two_slash
- atf_add_test_case two_dash
- }