From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH 1/2] Regression test for "stg delete"
Date: Sun, 22 Oct 2006 14:58:11 +0200 [thread overview]
Message-ID: <20061022125811.15194.63337.stgit@localhost> (raw)
In-Reply-To: <20061022125337.15194.64831.stgit@localhost>
From: Karl Hasselström <kha@treskal.com>
NOTE: The subtest that attempts to delete a patch in another branch
currently fails, because there's a bug in "delete".
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
t/t1600-delete.sh | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 109 insertions(+), 0 deletions(-)
diff --git a/t/t1600-delete.sh b/t/t1600-delete.sh
new file mode 100644
index 0000000..e22e624
--- /dev/null
+++ b/t/t1600-delete.sh
@@ -0,0 +1,109 @@
+#!/bin/sh
+# Copyright (c) 2006 Karl Hasselström
+test_description='Test the delete command.'
+. ./test-lib.sh
+
+test_expect_success \
+ 'Initialize the StGIT repository' \
+ 'stg init'
+
+test_expect_success \
+ 'Create a patch' \
+ '
+ stg new foo -m foo &&
+ echo foo > foo.txt &&
+ stg add foo.txt &&
+ stg refresh
+ '
+
+test_expect_success \
+ 'Try to delete a non-existing patch' \
+ '
+ [ $(stg applied | wc -l) -eq 1 ] &&
+ ! stg delete bar &&
+ [ $(stg applied | wc -l) -eq 1 ]
+ '
+
+test_expect_success \
+ 'Try to delete the topmost patch while dirty' \
+ '
+ echo dirty >> foo.txt &&
+ [ $(stg applied | wc -l) -eq 1 ] &&
+ ! stg delete foo &&
+ [ $(stg applied | wc -l) -eq 1 ] &&
+ git reset --hard
+ '
+
+test_expect_success \
+ 'Delete the topmost patch' \
+ '
+ [ $(stg applied | wc -l) -eq 1 ] &&
+ stg delete foo &&
+ [ $(stg applied | wc -l) -eq 0 ]
+ '
+
+test_expect_success \
+ 'Create an unapplied patch' \
+ '
+ stg new foo -m foo &&
+ echo foo > foo.txt &&
+ stg add foo.txt &&
+ stg refresh &&
+ stg pop
+ '
+
+test_expect_success \
+ 'Delete an unapplied patch' \
+ '
+ [ $(stg unapplied | wc -l) -eq 1 ] &&
+ stg delete foo &&
+ [ $(stg unapplied | wc -l) -eq 0 ]
+ '
+
+test_expect_success \
+ 'Create two patches' \
+ '
+ stg new foo -m foo &&
+ echo foo > foo.txt &&
+ stg add foo.txt &&
+ stg refresh &&
+ stg new bar -m bar &&
+ echo bar > bar.txt &&
+ stg add bar.txt &&
+ stg refresh
+ '
+
+test_expect_success \
+ 'Try to delete a non-topmost applied patch' \
+ '
+ [ $(stg applied | wc -l) -eq 2 ] &&
+ ! stg delete foo &&
+ [ $(stg applied | wc -l) -eq 2 ]
+ '
+
+test_expect_success \
+ 'Create another branch, and put one patch in each branch' \
+ '
+ stg branch --create br &&
+ stg new baz -m baz &&
+ echo baz > baz.txt &&
+ stg add baz.txt &&
+ stg refresh &&
+ stg branch master &&
+ stg new baz -m baz &&
+ echo baz > baz.txt &&
+ stg add baz.txt &&
+ stg refresh
+ '
+
+test_expect_success \
+ 'Delete a patch in another branch' \
+ '
+ [ $(stg applied | wc -l) -eq 3 ] &&
+ [ $(stg applied -b br | wc -l) -eq 1 ] &&
+ stg delete -b br baz &&
+ [ $(stg applied | wc -l) -eq 3 ] &&
+ [ $(stg applied -b br | wc -l) -eq 0 ]
+ '
+
+test_done
next prev parent reply other threads:[~2006-10-22 12:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-22 12:53 [PATCH 0/2] Teach "stg delete" to delete several patches at once Karl Hasselström
2006-10-22 12:58 ` Karl Hasselström [this message]
2006-10-22 12:58 ` [PATCH 2/2] Allow deletion of " Karl Hasselström
2006-10-22 13:01 ` Karl Hasselström
2006-10-23 11:57 ` Catalin Marinas
2006-10-23 12:37 ` Karl Hasselström
2006-11-01 9:07 ` [PATCH] " Karl Hasselström
2006-11-02 10:36 ` Catalin Marinas
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=20061022125811.15194.63337.stgit@localhost \
--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).