logo

utils

Old programs, got split in utils-std and utils-extra git clone https://hacktivis.me/git/utils.git

args (870B)


  1. #!/usr/bin/env atf-sh
  2. # SPDX-FileCopyrightText: 2017-2022 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. atf_test_case noargs
  5. noargs_body() {
  6. atf_check -o 'inline:argc: 1
  7. argv[0]: "../cmd/args"
  8. ' ../cmd/args
  9. }
  10. atf_test_case onearg
  11. onearg_body() {
  12. atf_check -o 'inline:argc: 2
  13. argv[0]: "../cmd/args"
  14. argv[1]: "a"
  15. ' ../cmd/args a
  16. }
  17. atf_test_case twoargs
  18. twoargs_body() {
  19. atf_check -o 'inline:argc: 3
  20. argv[0]: "../cmd/args"
  21. argv[1]: "a"
  22. argv[2]: "b c"
  23. ' ../cmd/args a 'b c'
  24. }
  25. atf_test_case options
  26. options_body() {
  27. atf_check -o 'inline:argc: 5
  28. argv[0]: "../cmd/args"
  29. argv[1]: "-1"
  30. argv[2]: "+2"
  31. argv[3]: "--3"
  32. argv[4]: "/4"
  33. ' ../cmd/args -1 +2 --3 /4
  34. }
  35. atf_init_test_cases() {
  36. cd "$(atf_get_srcdir)" || exit 1
  37. atf_add_test_case noargs
  38. atf_add_test_case onearg
  39. atf_add_test_case twoargs
  40. atf_add_test_case options
  41. }