summaryrefslogtreecommitdiff
path: root/tests/mv/update
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-08-06 15:50:45 +0000
committerJim Meyering <jim@meyering.net>2001-08-06 15:50:45 +0000
commit742dc8804a9170f7651d4881f9a3fcb7b88b711f (patch)
tree635853a5ddb6412037e1d9ac29780103a54586dc /tests/mv/update
parent11b02c5e135c32fa8dbae463b50ed8db10e103ad (diff)
downloadcoreutils-742dc8804a9170f7651d4881f9a3fcb7b88b711f.tar.xz
*** empty log message ***
Diffstat (limited to 'tests/mv/update')
-rwxr-xr-xtests/mv/update41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/mv/update b/tests/mv/update
new file mode 100755
index 000000000..4a3c2f551
--- /dev/null
+++ b/tests/mv/update
@@ -0,0 +1,41 @@
+#!/bin/sh
+# make sure --update works as advertised
+
+if test "$VERBOSE" = yes; then
+ set -x
+ mv --version
+fi
+
+. $srcdir/../envvar-check
+. $srcdir/../lang-default
+
+pwd=`pwd`
+tmp=mv-update.$$
+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
+echo old > old || framework_failure=1
+touch -d yesterday old || framework_failure=1
+echo new > new || framework_failure=1
+
+if test $framework_failure = 1; then
+ echo 'failure in testing framework' 1>&2
+ (exit 1); exit
+fi
+
+fail=0
+
+# This is a no-op.
+mv --update old new || fail=1
+case "`cat new`" in new) ;; *) fail=1 ;; esac
+case "`cat old`" in old) ;; *) fail=1 ;; esac
+
+# This will actually do the rename.
+mv --update new old || fail=1
+test -f new && fail=1
+case "`cat old`" in new) ;; *) fail=1 ;; esac
+
+(exit $fail); exit