logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git

echo (787B)


  1. #!/usr/bin/env atf-sh
  2. # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
  4. atf_test_case empty
  5. empty_body() {
  6. atf_check -o "inline:\n" ../bin/echo
  7. }
  8. atf_test_case hello
  9. hello_body() {
  10. atf_check -o "inline:hello world\n" ../bin/echo hello world
  11. }
  12. atf_test_case doubledash
  13. doubledash_body() {
  14. atf_check -o "inline:-- hello\n" ../bin/echo -- hello
  15. }
  16. atf_test_case devfull
  17. devfull_body() {
  18. atf_check -s exit:1 -e 'inline:write(1, buffer, arg_len): No space left on device\n' sh -c '../bin/echo hello world >/dev/full'
  19. }
  20. atf_init_test_cases() {
  21. cd "$(atf_get_srcdir)" || exit 1
  22. atf_add_test_case empty
  23. atf_add_test_case hello
  24. atf_add_test_case doubledash
  25. atf_add_test_case devfull
  26. }