logo

utils

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

unlink (714B)


  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 basic cleanup
  5. basic_body() {
  6. touch inputs/unlink-this || atf_fail "touch inputs/unlink-this"
  7. atf_check ../cmd/unlink inputs/unlink-this
  8. }
  9. basic_cleanup() {
  10. rm -f inputs/unlink-this || atf_fail "rm -f inputs/unlink-this"
  11. }
  12. atf_test_case enoent
  13. enoent_body() {
  14. # shellcheck disable=SC1112
  15. atf_check -s exit:1 -e 'inline:unlink: Cannot unlink ‘/var/empty/e/no/ent’: No such file or directory\n' ../cmd/unlink /var/empty/e/no/ent
  16. }
  17. atf_init_test_cases() {
  18. cd "$(atf_get_srcdir)" || exit 1
  19. atf_add_test_case basic
  20. atf_add_test_case enoent
  21. }