logo

utils-std

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

link.sh (766B)


  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/link"
  5. plans=4
  6. . "$(dirname "$0")/tap.sh"
  7. t --exit=1 noargs '' 'usage: link <reference> <destination>
  8. '
  9. basic_foo=$(mktemp)
  10. t basic "${basic_foo} ${basic_foo}.bar" ''
  11. printf '%s\n' $RANDOM > "${basic_foo}" || exit 1
  12. cmp "${basic_foo}" "${basic_foo}.bar" || exit 1
  13. printf '%s\n' $RANDOM > "${basic_foo}.bar" || exit 1
  14. cmp "${basic_foo}" "${basic_foo}.bar" || exit 1
  15. rm "${basic_foo}" "${basic_foo}.bar" || exit 1
  16. t --exit=1 enoent1 '/var/empty/e/no/ent enoent_foo' 'link: error: No such file or directory
  17. '
  18. t --exit=1 enoent2 'enoent_foo /var/empty/e/no/ent' 'link: error: No such file or directory
  19. '