]> Cypherpunks.ru repositories - goredo.git/blob - t/redo-sh.tests/whichdo_absolute_default_2/test
Import tests from apenwarr/redo and redo.sh
[goredo.git] / t / redo-sh.tests / whichdo_absolute_default_2 / test
1 #!/bin/sh -eu
2 # When invoked with an absolute filename for the file “default.do” as
3 # an argument, redo-whichdo must not output that filename as possible
4 # dofile.
5
6 default_dofile="${PWD}/default.do"
7
8 whichdo_dofiles=$(
9  redo-whichdo "${default_dofile}" \
10    |tr '\0' '\n'
11 )
12
13 for whichdo_dofile in ${whichdo_dofiles}; do
14  case "${whichdo_dofile}" in
15   "${default_dofile}")
16    >&2 printf 'redo-whichdo outputs that this file is its own dofile: %s\n' \
17     "${whichdo_dofile}"
18    exit 1
19   ;;
20  esac
21 done