All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <krh@redhat.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, "Kristian Høgsberg" <krh@redhat.com>
Subject: [PATCH] Add test case for basic commit functionality.
Date: Tue, 31 Jul 2007 15:37:30 -0400	[thread overview]
Message-ID: <11859106503866-git-send-email-krh@redhat.com> (raw)
In-Reply-To: <7vodhtgq99.fsf@assigned-by-dhcp.cox.net>

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---

Update: using test_tick now, create test files as part of tests, split
	amend failure and bad options failure into separate test cases.

 t/t7501-commit.sh |  133 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)
 create mode 100644 t/t7501-commit.sh

diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
new file mode 100644
index 0000000..ef0aab5
--- /dev/null
+++ b/t/t7501-commit.sh
@@ -0,0 +1,133 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com>
+#
+
+# FIXME: Test the various index usages, -i and -o, test reflog,
+# signoff, hooks
+
+test_description='git-commit'
+. ./test-lib.sh
+
+test_tick
+
+test_expect_success \
+	"initial status" \
+	"echo 'bongo bongo' >file &&
+	 git-add file && \
+	 git-status | grep 'Initial commit'"
+
+test_expect_failure \
+	"fail initial amend" \
+	"git-commit --amend"
+
+test_expect_success \
+	"initial commit" \
+	"git-commit -m initial"
+
+test_expect_failure \
+	"invalid options 1" \
+	"git-commit --amend -F file"
+
+test_expect_failure \
+	"invalid options 2" \
+	"git-commit -C HEAD -m illegal"
+
+test_expect_failure \
+	"using invalid commit with -C" \
+	"git-commit -C bogus"
+
+test_expect_failure \
+	"testing nothing to commit" \
+	"git-commit -m initial"
+
+test_expect_success \
+	"next commit" \
+	"echo 'bongo bongo bongo' >file \
+	 git-commit -m next -a"
+
+test_expect_failure \
+	"commit message from non-existing file" \
+	"echo 'more bongo: bongo bongo bongo bongo' >file && \
+	 git-commit -F gah -a"
+
+cat >msg <<EOF
+		
+
+  
+Signed-off-by: hula
+EOF
+test_expect_failure \
+	"empty commit message" \
+	"git-commit -F msg -a"
+
+test_expect_success \
+	"commit message from file" \
+	"echo 'this is the commit message, coming from a file' >msg && \
+	 git-commit -F msg -a"
+
+cat >editor <<\EOF
+#!/bin/sh
+sed -i -e "s/a file/an amend commit/g" $1
+EOF
+chmod 755 editor
+
+test_expect_success \
+	"amend commit" \
+	"VISUAL=./editor git-commit --amend"
+
+test_expect_failure \
+	"passing --amend and -F" \
+	"echo 'enough with the bongos' >file && \
+	 git-commit -F msg --amend ."
+
+test_expect_success \
+	"using message from other commit" \
+	"git-commit -C HEAD^ ."
+
+cat >editor <<\EOF
+#!/bin/sh
+sed -i -e "s/amend/older/g" $1
+EOF
+chmod 755 editor
+
+test_expect_success \
+	"editing message from other commit" \
+	"echo 'hula hula' >file && \
+	 VISUAL=./editor git-commit -c HEAD^ -a"
+
+test_expect_success \
+	"message from stdin" \
+	"echo 'silly new contents' >file && \
+	 echo commit message from stdin | git-commit -F - -a"
+
+test_expect_success \
+	"overriding author from command line" \
+	"echo 'gak' >file && \
+	 git-commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a"
+
+test_expect_success \
+	"interactive add" \
+	"echo 7 | git-commit --interactive | grep 'What now'"
+
+test_expect_success \
+	"showing committed revisions" \
+	"git-rev-list HEAD >current"
+
+# We could just check the head sha1, but checking each commit makes it
+# easier to isolate bugs.
+
+cat >expected <<\EOF
+72c0dc9855b0c9dadcbfd5a31cab072e0cb774ca
+9b88fc14ce6b32e3d9ee021531a54f18a5cf38a2
+3536bbb352c3a1ef9a420f5b4242d48578b92aa7
+d381ac431806e53f3dd7ac2f1ae0534f36d738b9
+4fd44095ad6334f3ef72e4c5ec8ddf108174b54a
+402702b49136e7587daa9280e91e4bb7cb2179f7
+EOF
+
+test_expect_success \
+    'validate git-rev-list output.' \
+    'diff current expected'
+
+test_done
-- 
1.5.2.GIT

      parent reply	other threads:[~2007-07-31 19:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-30 21:28 [PATCH 1/5] Add test case for basic commit functionality Kristian Høgsberg
2007-07-30 21:28 ` [PATCH 2/5] Enable wt-status output to a given FILE pointer Kristian Høgsberg
2007-07-30 21:28   ` [PATCH 3/5] Add strbuf_printf() to do formatted printing to a strbuf Kristian Høgsberg
2007-07-30 21:28     ` [PATCH 4/5] Make builtin-commit-tree use a strbuf instead of hand-rolled realloc buffer Kristian Høgsberg
2007-07-30 21:28       ` [PATCH 5/5] Split out the actual commit creation from the option parsing etc Kristian Høgsberg
2007-07-31  4:43         ` Junio C Hamano
2007-07-31 14:11           ` Kristian Høgsberg
2007-07-31  4:39       ` [PATCH 4/5] Make builtin-commit-tree use a strbuf instead of hand-rolled realloc buffer Junio C Hamano
2007-07-31  4:36     ` [PATCH 3/5] Add strbuf_printf() to do formatted printing to a strbuf Junio C Hamano
2007-07-31 14:23       ` Kristian Høgsberg
2007-07-31 14:55         ` Johannes Schindelin
2007-07-31 15:33           ` Kristian Høgsberg
2007-07-31 14:57         ` Johannes Schindelin
2007-07-31 15:28           ` Kristian Høgsberg
2007-07-31 19:54       ` [PATCH] " Kristian Høgsberg
2007-07-31 22:01         ` Junio C Hamano
2007-07-31  4:18 ` [PATCH 1/5] Add test case for basic commit functionality Junio C Hamano
2007-07-31 14:27   ` Kristian Høgsberg
2007-07-31 19:37   ` Kristian Høgsberg [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=11859106503866-git-send-email-krh@redhat.com \
    --to=krh@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.