]> Cypherpunks.ru repositories - goredo.git/blobdiff - t/redo-sh.tests/whichdo_relative_default_1/test
Import tests from apenwarr/redo and redo.sh
[goredo.git] / t / redo-sh.tests / whichdo_relative_default_1 / test
diff --git a/t/redo-sh.tests/whichdo_relative_default_1/test b/t/redo-sh.tests/whichdo_relative_default_1/test
new file mode 100755 (executable)
index 0000000..9ef5597
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh -eu
+# When invoked with a relative path name with the prefix “default” as
+# an argument, redo-whichdo must not output any dofile filename twice.
+
+default_files="default default.a default.a.b default.do default.a.do default.a.b.do"
+
+for default_file in ${default_files}; do
+ whichdo_dofiles_duplicates=$(
+  redo-whichdo "${default_file}" \
+   |tr '\0' '\n' \
+   |sort \
+   |uniq -d
+ )
+ case "${whichdo_dofiles_duplicates}" in
+  '')
+   ;;
+  *)
+   >&2 printf 'redo-whichdo duplicate output: %s \n' ${whichdo_dofiles_duplicates}
+   exit 1
+  ;;
+ esac
+done