X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=t%2Fredo-sh.tests%2Fwhichdo_relative_default_2%2Ftest;fp=t%2Fredo-sh.tests%2Fwhichdo_relative_default_2%2Ftest;h=385cf5f1c52503fdfe446121fab0e1474bee86e1;hb=a6510ac6225a3a93df9d27dc316a3c1c0fcde426;hp=0000000000000000000000000000000000000000;hpb=a5111e179e5aca57420fd1cc95c1b21e7cd34226;p=goredo.git diff --git a/t/redo-sh.tests/whichdo_relative_default_2/test b/t/redo-sh.tests/whichdo_relative_default_2/test new file mode 100755 index 0000000..385cf5f --- /dev/null +++ b/t/redo-sh.tests/whichdo_relative_default_2/test @@ -0,0 +1,21 @@ +#!/bin/sh -eu +# When invoked with a relative filename for the file “default.do” as +# an argument, redo-whichdo must not output that filename as possible +# dofile. + +default_dofile="default.do" + +whichdo_dofiles=$( + redo-whichdo "${default_dofile}" \ + |tr '\0' '\n' +) + +for whichdo_dofile in ${whichdo_dofiles}; do + case "${whichdo_dofile}" in + "${PWD}/${default_dofile}") + >&2 printf 'redo-whichdo outputs that this file is its own dofile: %s\n' \ + "${whichdo_dofile}" + exit 1 + ;; + esac +done