logo

utils-std

Collection of commonly available Unix tools

echo (1034B)


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