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/2] Test the new stg delete --spill flag
Date: Sun, 21 Sep 2008 21:07:36 +0200	[thread overview]
Message-ID: <20080921190736.4503.80527.stgit@yoghurt> (raw)
In-Reply-To: <20080921190708.4503.20574.stgit@yoghurt>

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

---

 t/t1602-delete-spill.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100755 t/t1602-delete-spill.sh


diff --git a/t/t1602-delete-spill.sh b/t/t1602-delete-spill.sh
new file mode 100755
index 0000000..1ddec53
--- /dev/null
+++ b/t/t1602-delete-spill.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+test_description='Test "stg delete --spill"'
+. ./test-lib.sh
+
+test_expect_success 'Initialize the StGIT repository' '
+    stg init
+'
+
+test_expect_success 'Create five applied and three unapplied patches' '
+    for i in 0 1 2 3 4 5 6 7; do
+        echo $i >> foo &&
+        git add foo &&
+        git commit -m p$i
+    done
+    stg uncommit -n 8 &&
+    stg pop -n 3
+'
+
+test_expect_success 'Try to delete --spill an unapplied patch' '
+    command_error stg delete --spill p7 &&
+    test "$(echo $(stg series))" = "+ p0 + p1 + p2 + p3 > p4 - p5 - p6 - p7" &&
+    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
+    test "$(echo $(git diff-files))" = ""
+'
+
+test_expect_success 'Try to delete --spill a non-top patch' '
+    command_error stg delete --spill p2 &&
+    test "$(echo $(stg series))" = "+ p0 + p1 + p2 + p3 > p4 - p5 - p6 - p7" &&
+    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
+    test "$(echo $(git diff-files))" = ""
+'
+
+test_expect_success 'Delete --spill one patch' '
+    stg delete --spill p4 &&
+    test "$(echo $(stg series))" = "+ p0 + p1 + p2 > p3 - p5 - p6 - p7" &&
+    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
+    test "$(echo $(git diff-files))" = ""
+'
+
+test_expect_success 'Delete --spill several patches' '
+    stg delete --spill p2 p3 p1 &&
+    test "$(echo $(stg series))" = "> p0 - p5 - p6 - p7" &&
+    test "$(echo $(cat foo))" = "0 1 2 3 4" &&
+    test "$(echo $(git diff-files))" = ""
+'
+
+test_done

      parent reply	other threads:[~2008-09-21 19:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-21 19:07 [StGit PATCH 0/2] stg delete --spill Karl Hasselström
2008-09-21 19:07 ` [StGit PATCH 1/2] Add a new flag, --spill, to stg delete Karl Hasselström
2008-09-21 19:07 ` Karl Hasselström [this message]

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=20080921190736.4503.80527.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).