*** empty log message ***
[coreutils.git] / tests / mv / diag
blob125e8658cdb7061570efc64895f895de7c0ece47
1 #!/bin/sh
2 # make sure we get proper diagnostics: e.g., with --target-dir=d but no args
4 if test "$VERBOSE" = yes; then
5 set -x
6 mv --version
7 fi
9 # Make sure we get English translations.
10 . $srcdir/../lang-default
12 pwd=`pwd`
13 tmp=diag-$$
14 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
15 trap 'exit $?' 1 2 13 15
17 framework_failure=0
18 mkdir $tmp || framework_failure=1
19 cd $tmp || framework_failure=1
21 touch f1 || framework_failure=1
22 touch f2 || framework_failure=1
23 touch d || framework_failure=1
25 if test $framework_failure = 1; then
26 echo 'failure in testing framework'
27 exit 1
30 # These mv commands should all exit nonzero.
32 # Too few args. This first one did fail, but with an incorrect diagnostic
33 # until fileutils-4.0u.
34 mv --target=d >> out 2>&1 && fail=1
35 mv no-file >> out 2>&1 && fail=1
37 # Target is not a directory.
38 mv f1 f2 f1 >> out 2>&1 && fail=1
39 mv --target=f2 f1 >> out 2>&1 && fail=1
41 cat > exp <<\EOF
42 mv: missing file argument
43 Try `mv --help' for more information.
44 mv: missing file argument
45 Try `mv --help' for more information.
46 mv: when moving multiple files, last argument must be a directory
47 Try `mv --help' for more information.
48 mv: specified target, `f2' is not a directory
49 Try `mv --help' for more information.
50 EOF
52 cmp out exp || fail=1
54 (exit $fail)
55 exit $fail