summaryrefslogtreecommitdiff
path: root/tests/mv/into-self
blob: 860940aafadfe8c75ba59f3fb922e373c8ef78cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /bin/sh

: ${MV=mv}
: ${MKDIR=mkdir}
: ${RM=rm}
: ${TOUCH=touch}

dir=into-self-dir
file=into-self-file

test_failure=0

$RM -rf $dir $file || test_failure=1
$MKDIR -p $dir/a/b || test_failure=1
$TOUCH $file || test_failure=1

if test $test_failure = 1; then
  echo 'failure in testing framework'
  exit 1
fi

fail=0
$MV $dir $file $dir || fail=1
# Make sure the file is gone.
test -f $file && fail=1
# Make sure the directory is *not* gone.
test -d $dir/$dir/a/b || fail=1
# Make sure the file has been moved to the right place.
test -f $dir/$file || fail=1
$RM -rf $dir $file

exit $fail