logo

utils-std

Collection of commonly available Unix tools

link (864B)


  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 -s exit:1 -e "inline:usage: link <reference> <destination>\n" ../cmd/link
  7. }
  8. atf_test_case basic cleanup
  9. basic_body() {
  10. touch foo
  11. atf_check ../cmd/link foo bar
  12. atf_check cmp foo bar
  13. echo hello >> foo
  14. atf_check cmp foo bar
  15. }
  16. basic_cleanup() {
  17. atf_check rm -f foo bar
  18. }
  19. atf_test_case enoent
  20. enoent_body() {
  21. atf_check -s exit:1 -e 'inline:link: No such file or directory\n' ../cmd/link /var/empty/e/no/ent enoent_foo
  22. atf_check -s exit:1 -e 'inline:link: No such file or directory\n' ../cmd/link enoent_bar /var/empty/e/no/ent
  23. }
  24. atf_init_test_cases() {
  25. cd "$(atf_get_srcdir)" || exit 1
  26. atf_add_test_case empty
  27. atf_add_test_case basic
  28. atf_add_test_case enoent
  29. }