summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1998-03-14 10:37:29 +0000
committerJim Meyering <jim@meyering.net>1998-03-14 10:37:29 +0000
commita7a6111f8143295fc37d16b04dd92a89f1ad849f (patch)
tree7e07baf07d0aa90c9e27bb4a7542ee7805373aaf
parent7c579a02319bb6b22c9e542aa5271199cb95158d (diff)
downloadcoreutils-a7a6111f8143295fc37d16b04dd92a89f1ad849f.tar.gz
.
-rwxr-xr-xtests/mv/into-self31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/mv/into-self b/tests/mv/into-self
new file mode 100755
index 000000000..c7b29b6bd
--- /dev/null
+++ b/tests/mv/into-self
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+: ${MV=mv}
+: ${MKDIR=mkdir}
+: ${RM=rm}
+: ${TOUCH=touch}
+
+dir=into-self-dir
+file=into-self-file
+
+test_failure=0
+
+$RM -f $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
+
+exit $fail