[PATCH 02 of 13] Add a test for the purge extension

Emanuele Aina faina.mail at tiscali.it
Tue Feb 27 07:06:02 UTC 2007


# HG changeset patch
# User Emanuele Aina <em at nerd.ocracy.org>
# Date 1172563536 -3600
# Node ID 719dccfa8eaccc3071806fd82e80176328f79e3e
# Parent  aa4aa482615f6cece71ce4530cb1824a34736510
Add a test for the purge extension

diff --git a/tests/test-purge b/tests/test-purge
new file mode 100755
--- /dev/null
+++ b/tests/test-purge
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+cat <<EOF >> $HGRCPATH
+[extensions]
+purge=${TESTDIR}/../contrib/purge/purge.py
+EOF
+
+echo % init
+hg init t
+cd t
+
+echo % setup
+echo r1 > r1
+hg ci -Amr1 -d'0 0'
+mkdir directory
+echo r2 > directory/r2
+hg ci -Amr2 -d'1 0'
+
+echo % delete an empty directory
+mkdir empty_dir
+hg purge -p
+hg purge -v
+ls
+
+echo % delete an untracked directory
+mkdir untracked_dir
+touch untracked_dir/untracked_file1
+touch untracked_dir/untracked_file2
+hg purge -p
+hg purge -v
+ls
+
+echo % delete an untracked file
+touch untracked_file
+hg purge -p
+hg purge -v
+ls
+
+echo % delete an untracked file in a tracked directory
+touch directory/untracked_file
+hg purge -p
+hg purge -v
+ls
+
+echo % delete nested directories
+mkdir -p untracked_directory/nested_directory
+hg purge -p
+hg purge -v
+ls
diff --git a/tests/test-purge.out b/tests/test-purge.out
new file mode 100644
--- /dev/null
+++ b/tests/test-purge.out
@@ -0,0 +1,33 @@
+% init
+% setup
+adding r1
+adding directory/r2
+% delete an empty directory
+empty_dir
+Removing directory empty_dir
+directory
+r1
+% delete an untracked directory
+untracked_dir/untracked_file1
+untracked_dir/untracked_file2
+Removing file untracked_dir/untracked_file1
+Removing file untracked_dir/untracked_file2
+Removing directory untracked_dir
+directory
+r1
+% delete an untracked file
+untracked_file
+Removing file untracked_file
+directory
+r1
+% delete an untracked file in a tracked directory
+directory/untracked_file
+Removing file directory/untracked_file
+directory
+r1
+% delete nested directories
+untracked_directory/nested_directory
+Removing directory untracked_directory/nested_directory
+Removing directory untracked_directory
+directory
+r1



More information about the Mercurial-devel mailing list