changeset 4101:e2ed92f4c0f7

add some tests for qpush/qpop error codes
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 17 Feb 2007 04:50:06 -0200
parents c30c922f907a
children 06d65498f73b 226df1808f16
files tests/test-mq tests/test-mq.out
diffstat 2 files changed, 95 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-mq	Tue Feb 13 08:54:48 2007 -0500
+++ b/tests/test-mq	Sat Feb 17 04:50:06 2007 -0200
@@ -169,6 +169,46 @@
 hg qpop -a
 hg push ../../k
 
+echo % qpush/qpop error codes
+errorcode()
+{
+    hg "$@" && echo "  $@ succeeds" || echo "  $@ fails"
+}
+
+# we want to start with some patches applied
+hg qpush -a
+echo "  % pops all patches and succeeds"
+errorcode qpop -a
+echo "  % does nothing and succeeds"
+errorcode qpop -a
+echo "  % fails - nothing else to pop"
+errorcode qpop
+echo "  % pushes a patch and succeeds"
+errorcode qpush
+echo "  % pops a patch and succeeds"
+errorcode qpop
+echo "  % pushes up to test1b.patch and succeeds"
+errorcode qpush test1b.patch
+echo "  % does nothing and succeeds"
+errorcode qpush test1b.patch
+echo "  % does nothing and succeeds"
+errorcode qpop test1b.patch
+echo "  % fails - can't push to this patch"
+errorcode qpush test.patch
+echo "  % fails - can't pop to this patch"
+errorcode qpop test2.patch
+echo "  % pops up to test.patch and succeeds"
+errorcode qpop test.patch
+echo "  % pushes all patches and succeeds"
+errorcode qpush -a
+echo "  % does nothing and succeeds"
+errorcode qpush -a
+echo "  % fails - nothing else to push"
+errorcode qpush
+echo "  % does nothing and succeeds"
+errorcode qpush test2.patch
+
+
 echo % strip
 cd ../../b
 echo x>x
--- a/tests/test-mq.out	Tue Feb 13 08:54:48 2007 -0500
+++ b/tests/test-mq.out	Sat Feb 17 04:50:06 2007 -0200
@@ -156,6 +156,61 @@
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
+% qpush/qpop error codes
+applying test.patch
+applying test1b.patch
+applying test2.patch
+Now at: test2.patch
+  % pops all patches and succeeds
+Patch queue now empty
+  qpop -a succeeds
+  % does nothing and succeeds
+no patches applied
+  qpop -a succeeds
+  % fails - nothing else to pop
+no patches applied
+  qpop fails
+  % pushes a patch and succeeds
+applying test.patch
+Now at: test.patch
+  qpush succeeds
+  % pops a patch and succeeds
+Patch queue now empty
+  qpop succeeds
+  % pushes up to test1b.patch and succeeds
+applying test.patch
+applying test1b.patch
+Now at: test1b.patch
+  qpush test1b.patch succeeds
+  % does nothing and succeeds
+qpush: test1b.patch is already at the top
+  qpush test1b.patch succeeds
+  % does nothing and succeeds
+qpop: test1b.patch is already at the top
+  qpop test1b.patch succeeds
+  % fails - can't push to this patch
+abort: cannot push to a previous patch: test.patch
+  qpush test.patch fails
+  % fails - can't pop to this patch
+abort: patch test2.patch is not applied
+  qpop test2.patch fails
+  % pops up to test.patch and succeeds
+Now at: test.patch
+  qpop test.patch succeeds
+  % pushes all patches and succeeds
+applying test1b.patch
+applying test2.patch
+Now at: test2.patch
+  qpush -a succeeds
+  % does nothing and succeeds
+all patches are currently applied
+  qpush -a succeeds
+  % fails - nothing else to push
+patch series already fully applied
+  qpush fails
+  % does nothing and succeeds
+all patches are currently applied
+  qpush test2.patch succeeds
 % strip
 adding x
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved