args (891B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
- atf_test_case noargs
- noargs_body() {
- atf_check -o 'inline:argc: 1
- argv[0]: "../bin/args"
- ' ../bin/args
- }
- atf_test_case onearg
- onearg_body() {
- atf_check -o 'inline:argc: 2
- argv[0]: "../bin/args"
- argv[1]: "a"
- ' ../bin/args a
- }
- atf_test_case twoargs
- twoargs_body() {
- atf_check -o 'inline:argc: 3
- argv[0]: "../bin/args"
- argv[1]: "a"
- argv[2]: "b c"
- ' ../bin/args a 'b c'
- }
- atf_test_case options
- options_body() {
- atf_check -o 'inline:argc: 5
- argv[0]: "../bin/args"
- argv[1]: "-1"
- argv[2]: "+2"
- argv[3]: "--3"
- argv[4]: "/4"
- ' ../bin/args -1 +2 --3 /4
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- atf_add_test_case noargs
- atf_add_test_case onearg
- atf_add_test_case twoargs
- atf_add_test_case options
- }