echo (1026B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- atf_test_case empty
- empty_body() {
- atf_check -o "inline:\n" ../cmd/echo
- }
- atf_test_case hello
- hello_body() {
- atf_check -o "inline:hello world\n" ../cmd/echo hello world
- }
- atf_test_case doubledash
- doubledash_body() {
- atf_check -o "inline:-- hello\n" ../cmd/echo -- hello
- }
- atf_test_case devfull
- devfull_body() {
- atf_check -s exit:1 -e 'inline:echo: write(1, buffer, arg_len): No space left on device\n' sh -c '../cmd/echo hello world >/dev/full'
- }
- atf_test_case opt_n
- opt_n_body() {
- atf_check -o "inline:" ../cmd/echo -n
- atf_check -o "inline:foo" ../cmd/echo -n foo
- atf_check -o "inline:foo bar" ../cmd/echo -n foo bar
- atf_check -o "inline:-- foo" ../cmd/echo -n -- foo
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- atf_add_test_case empty
- atf_add_test_case hello
- atf_add_test_case doubledash
- atf_add_test_case devfull
- atf_add_test_case opt_n
- }