logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

dirname.sh (611B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. target="$(dirname "$0")/../cmd/dirname"
  5. plans=10
  6. . "$(dirname "$0")/tap.sh"
  7. # atf_check -e "inline:usage: dirname string\n" -s exit:1 ../cmd/dirname
  8. t '/usr/bin' '/usr/bin' '/usr
  9. '
  10. t '/usr//bin' '/usr//bin' '/usr
  11. '
  12. t '-- /usr//bin' '/usr//bin' '/usr
  13. '
  14. t '.' '.' '.
  15. '
  16. t '-' '-' '.
  17. '
  18. t '/' '/' '/
  19. '
  20. t '///' '///' '/
  21. '
  22. t '---' '---' '.
  23. '
  24. t '--foo' '--foo' '.
  25. '
  26. t './foobar' './foobar' '.
  27. '
  28. # atf_check -s exit:1 -e "inline:usage: dirname string\n" ../cmd/dirname -a "/usr//bin"