summaryrefslogtreecommitdiff
path: root/tests/mv/force
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-05-23 13:36:37 +0000
committerJim Meyering <jim@meyering.net>1999-05-23 13:36:37 +0000
commit78d7d7b7464576d0c7f899a7ea16959e3a5b1365 (patch)
treea8f67f1fdb9550554c39344bf30aafc57d38ed02 /tests/mv/force
parent77cf4d48dde4c843c385e60c940edd3933f2d377 (diff)
downloadcoreutils-78d7d7b7464576d0c7f899a7ea16959e3a5b1365.tar.xz
*** empty log message ***
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