summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/mv/i-343
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/mv/i-3 b/tests/mv/i-3
new file mode 100755
index 000000000..24e0e737f
--- /dev/null
+++ b/tests/mv/i-3
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Make sure `mv file unwritable-file' prompts the user.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ mv --version
+fi
+
+. $srcdir/../envvar-check
+. $srcdir/../lang-default
+. $srcdir/../root-only
+
+pwd=`pwd`
+tmp=mv-i.$$
+trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
+trap '(exit $?); exit' 1 2 13 15
+
+framework_failure=0
+mkdir $tmp || framework_failure=1
+cd $tmp || framework_failure=1
+touch f g || framework_failure=1
+chmod 0 g || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo 'failure in testing framework' 1>&2
+ (exit 1); exit
+fi
+
+fail=0
+
+ls /dev/stdin >/dev/null 2>&1 \
+ || { (exit 77); exit; }
+mv f g < /dev/stdin > out 2>&1 & pid=$!
+sleep 1
+kill $pid
+
+# Make sure out contains the prompt.
+case "`cat out`" in
+ "mv: overwrite \`g', overriding mode 0000?"*) ;;
+ *) fail=1 ;;
+esac
+
+(exit $fail); exit