git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [StGIT PATCH 2/3] Test patch order, not just number of patches
Date: Sun, 13 May 2007 20:27:25 +0200	[thread overview]
Message-ID: <20070513182725.18810.85322.stgit@yoghurt> (raw)
In-Reply-To: <20070513182720.18810.64330.stgit@yoghurt>

From: Karl Hasselström <kha@treskal.com>

In addition to testing the number of applied patches, also test their
order. And test the order of unapplied patches too while we're at it.

Signed-off-by: Karl Hasselström <kha@treskal.com>
---

 t/t2000-sync.sh |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/t/t2000-sync.sh b/t/t2000-sync.sh
index 02345bb..69ab1ac 100755
--- a/t/t2000-sync.sh
+++ b/t/t2000-sync.sh
@@ -29,7 +29,9 @@ test_expect_success \
     stg add foo3.txt &&
     stg refresh &&
     stg export &&
-    stg pop
+    stg pop &&
+    [ "$(echo $(stg applied))" = "p1 p2" ] &&
+    [ "$(echo $(stg unapplied))" = "p3" ]
     '
 
 test_expect_success \
@@ -38,15 +40,17 @@ test_expect_success \
     stg branch -c foo base &&
     stg new p1 -m p1 &&
     stg new p2 -m p2 &&
-    stg new p3 -m p3
-    test $(stg applied -c) -eq 3
+    stg new p3 -m p3 &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ]
     '
 
 test_expect_success \
     'Synchronise second patch with the master branch' \
     '
     stg sync -b master p2 &&
-    test $(stg applied -c) -eq 3 &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ] &&
     test $(cat foo2.txt) = "foo2"
     '
 
@@ -54,7 +58,8 @@ test_expect_success \
     'Synchronise the first two patches with the master branch' \
     '
     stg sync -b master -a &&
-    test $(stg applied -c) -eq 3 &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ] &&
     test $(cat foo1.txt) = "foo1" &&
     test $(cat foo2.txt) = "foo2"
     '
@@ -63,7 +68,8 @@ test_expect_success \
     'Synchronise all the patches with the exported series' \
     '
     stg sync -s patches-master/series -a &&
-    test $(stg applied -c) -eq 3 &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ] &&
     test $(cat foo1.txt) = "foo1" &&
     test $(cat foo2.txt) = "foo2" &&
     test $(cat foo3.txt) = "foo3"
@@ -73,6 +79,8 @@ test_expect_success \
     'Modify the master patches' \
     '
     stg branch master &&
+    [ "$(echo $(stg applied))" = "p1 p2" ] &&
+    [ "$(echo $(stg unapplied))" = "p3" ] &&
     stg goto p1 &&
     echo bar1 >> foo1.txt &&
     stg refresh &&
@@ -83,6 +91,8 @@ test_expect_success \
     stg goto p3 &&
     echo bar3 >> foo3.txt &&
     stg refresh &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ] &&
     stg export &&
     stg branch foo
     '
@@ -91,7 +101,8 @@ test_expect_success \
     'Synchronise second patch with the master branch' \
     '
     stg sync -b master p2 &&
-    test $(stg applied -c) -eq 3 &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ] &&
     test $(cat bar2.txt) = "bar2"
     '
 
@@ -104,10 +115,13 @@ test_expect_failure \
 test_expect_success \
     'Restore the stack status after the failed sync' \
     '
-    test $(stg applied -c) -eq 1 &&
+    [ "$(echo $(stg applied))" = "p1" ] &&
+    [ "$(echo $(stg unapplied))" = "p2 p3" ] &&
     stg resolved -a &&
     stg refresh &&
     stg goto p3
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ]
     '
 
 test_expect_failure \
@@ -119,9 +133,12 @@ test_expect_failure \
 test_expect_success \
     'Restore the stack status after the failed sync' \
     '
-    test $(stg applied -c) -eq 3 &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ] &&
     stg resolved -a &&
-    stg refresh
+    stg refresh &&
+    [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
+    [ "$(echo $(stg unapplied))" = "" ]
     '
 
 test_done

  reply	other threads:[~2007-05-13 18:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-13 18:27 [StGIT PATCH 1/3] Make patch deletion test more specific Karl Hasselström
2007-05-13 18:27 ` Karl Hasselström [this message]
2007-05-13 18:27 ` [StGIT PATCH 3/3] Use "stg applied" instead of reading the applied file directly Karl Hasselström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070513182725.18810.85322.stgit@yoghurt \
    --to=kha@treskal.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).