diff options
author | Jim Meyering <jim@meyering.net> | 2001-08-06 15:50:45 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2001-08-06 15:50:45 +0000 |
commit | 742dc8804a9170f7651d4881f9a3fcb7b88b711f (patch) | |
tree | 635853a5ddb6412037e1d9ac29780103a54586dc /tests/mv | |
parent | 11b02c5e135c32fa8dbae463b50ed8db10e103ad (diff) | |
download | coreutils-742dc8804a9170f7651d4881f9a3fcb7b88b711f.tar.xz |
*** empty log message ***
Diffstat (limited to 'tests/mv')
-rwxr-xr-x | tests/mv/update | 41 |
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 |