diff options
Diffstat (limited to 'tests/mv/dir-file')
-rwxr-xr-x | tests/mv/dir-file | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/mv/dir-file b/tests/mv/dir-file new file mode 100755 index 0000000..9c540b2 --- /dev/null +++ b/tests/mv/dir-file @@ -0,0 +1,47 @@ +#!/bin/sh +# mv must fail when src and dest are mismatched directory/non-directory. + +# Copyright (C) 2000, 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +if test "$VERBOSE" = yes; then + set -x + mv --version +fi + +tmp=mv-mismatch-$$ +pwd=`pwd` +trap 'cd "$pwd" && rm -rf $tmp' 0 1 2 3 15 + +framework_failure=0 +mkdir $tmp || framework_failure=1 +cd $tmp +mkdir -p dir/file || framework_failure=1 +> file || framework_failure=1 + +if test $framework_failure = 1; then + echo 'failure in testing framework' + exit 1 +fi + +fail=0 + +# These should both fail, but until fileutils-4.0q only the second one did. +mv dir file > /dev/null 2>&1 && fail=1 +mv file dir > /dev/null 2>&1 && fail=1 + +exit $fail |