2 # ensure that --no-target-directory (-T) works when the destination is
5 if test "$VERBOSE" = yes; then
11 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
12 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
13 trap '(exit $?); exit $?' 1 2 13 15
16 mkdir -p $tmp || framework_failure=1
17 cd $tmp || framework_failure=1
18 mkdir -p d/sub empty src d2/sub e2 || framework_failure=1
19 touch f || framework_failure=1
21 if test $framework_failure = 1; then
22 echo "$0: failure in testing framework" 1>&2
28 # This should succeed, since both src and dest are directories,
29 # and the dest dir is empty.
30 mv -fT d empty || fail=1
32 # Ensure that the source, d, is gone.
33 ls -d d > /dev/null 2>&1 && fail=1
35 # Ensure that the dest dir now has a subdirectory.
36 test -d empty/sub || fail=1
39 # rename must fail, since the dest is non-empty.
40 mv -fT src d2 2> /dev/null && fail=1
42 # rename must fail, since the src is not a directory.
43 mv -fT f e2 2> /dev/null && fail=1
45 (exit $fail); exit $fail