summaryrefslogtreecommitdiff
path: root/tests/mv/force
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mv/force')
-rwxr-xr-xtests/mv/force40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/mv/force b/tests/mv/force
new file mode 100755
index 000000000..407a482d1
--- /dev/null
+++ b/tests/mv/force
@@ -0,0 +1,40 @@
+#!/bin/sh
+# move a file onto itself with --force
+
+if test "$VERBOSE" = yes; then
+ set -x
+ mv --version
+fi
+
+ff=force-file
+
+framework_failure=0
+rm -f $ff || framework_failure=1
+echo force-contents > $ff || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo 'failure in testing framework'
+ exit 1
+fi
+
+# Make sure we get English translations.
+LANGUAGE=C
+export LANGUAGE
+LC_ALL=C
+export LC_ALL
+LANG=C
+export LANG
+
+# This mv command should exit nonzero.
+mv --force $ff $ff > out 2>&1 && fail=1
+
+cat > exp <<EOF
+mv: \`$ff' and \`$ff' are the same file
+EOF
+
+cmp out exp || fail=1
+test `cat $ff` = force-contents || fail=1
+
+rm -fr out exp $ff
+
+exit $fail