logo

utils

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

link (890B)


  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 -s exit:1 -e "inline:usage: link <reference> <destination>\n" ../bin/link
  7. }
  8. atf_test_case basic cleanup
  9. basic_body() {
  10. touch foo
  11. atf_check ../bin/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' ../bin/link /var/empty/e/no/ent enoent_foo
  22. atf_check -s exit:1 -e 'inline:link: No such file or directory\n' ../bin/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. }