--- /dev/null
+#!/bin/sh -eu
+# When invoked with an absolute 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 "${PWD}/${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