git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 07/10] t/t9001-send-email.sh: convert setup code to tests
Date: Fri, 13 Aug 2010 20:40:10 +0000	[thread overview]
Message-ID: <1281732013-18284-8-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1281732013-18284-1-git-send-email-avarab@gmail.com>

Change the setup code in t/t9001-send-email.sh to use
test_expect_success. This way it isn't needlessly run in environments
where the test prerequisites aren't met.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t9001-send-email.sh |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index bd17d31..71b3df9 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -85,12 +85,15 @@ test_expect_success $PREREQ 'Send patches' '
      git send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
 '
 
+test_expect_success $PREREQ 'setup expect' '
 cat >expected <<\EOF
 !nobody@example.com!
 !author@example.com!
 !one@example.com!
 !two@example.com!
 EOF
+'
+
 test_expect_success $PREREQ \
     'Verify commandline' \
     'test_cmp expected commandline1'
@@ -100,6 +103,7 @@ test_expect_success $PREREQ 'Send patches with --envelope-sender' '
      git send-email --envelope-sender="Patch Contributer <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
 '
 
+test_expect_success $PREREQ 'setup expect' '
 cat >expected <<\EOF
 !patch@example.com!
 !-i!
@@ -108,6 +112,8 @@ cat >expected <<\EOF
 !one@example.com!
 !two@example.com!
 EOF
+'
+
 test_expect_success $PREREQ \
     'Verify commandline' \
     'test_cmp expected commandline1'
@@ -117,6 +123,7 @@ test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' '
      git send-email --envelope-sender=auto --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
 '
 
+test_expect_success $PREREQ 'setup expect' '
 cat >expected <<\EOF
 !nobody@example.com!
 !-i!
@@ -125,10 +132,13 @@ cat >expected <<\EOF
 !one@example.com!
 !two@example.com!
 EOF
+'
+
 test_expect_success $PREREQ \
     'Verify commandline' \
     'test_cmp expected commandline1'
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-show-all-headers <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -158,6 +168,7 @@ References: <unique-message-id@example.com>
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ 'Show all headers' '
 	git send-email \
@@ -209,10 +220,10 @@ test_expect_success $PREREQ 'cccmd works' '
 	grep "^	cccmd@example.com" msgtxt1
 '
 
-z8=zzzzzzzz
-z64=$z8$z8$z8$z8$z8$z8$z8$z8
-z512=$z64$z64$z64$z64$z64$z64$z64$z64
 test_expect_success $PREREQ 'reject long lines' '
+	z8=zzzzzzzz &&
+	z64=$z8$z8$z8$z8$z8$z8$z8$z8 &&
+	z512=$z64$z64$z64$z64$z64$z64$z64$z64 &&
 	clean_fake_sendmail &&
 	cp $patches longline.patch &&
 	echo $z512$z512 >>longline.patch &&
@@ -312,6 +323,7 @@ test_expect_success $PREREQ 'second message is patch' '
 	grep "Subject:.*Second" msgtxt2
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-sob <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -338,6 +350,7 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_suppression () {
 	git send-email \
@@ -359,6 +372,7 @@ test_expect_success $PREREQ 'sendemail.cc set' '
 	test_suppression sob
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-sob <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -383,12 +397,14 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ 'sendemail.cc unset' '
 	git config --unset sendemail.cc &&
 	test_suppression sob
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-cccmd <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -416,6 +432,7 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ 'sendemail.cccmd' '
 	echo echo cc-cmd@example.com > cccmd &&
@@ -424,6 +441,7 @@ test_expect_success $PREREQ 'sendemail.cccmd' '
 	test_suppression cccmd
 '
 
+test_expect_success $PREREQ 'setup expect' '
 cat >expected-suppress-all <<\EOF
 0001-Second.patch
 Dry-OK. Log says:
@@ -439,11 +457,13 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+'
 
 test_expect_success $PREREQ '--suppress-cc=all' '
 	test_suppression all
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-body <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -471,11 +491,13 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ '--suppress-cc=body' '
 	test_suppression body
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-body-cccmd <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -500,11 +522,13 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ '--suppress-cc=body --suppress-cc=cccmd' '
 	test_suppression body cccmd
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-sob <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -529,12 +553,14 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ '--suppress-cc=sob' '
 	git config --unset sendemail.cccmd
 	test_suppression sob
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-bodycc <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -562,11 +588,13 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ '--suppress-cc=bodycc' '
 	test_suppression bodycc
 '
 
+test_expect_success $PREREQ 'setup expect' "
 cat >expected-suppress-cc <<\EOF
 0001-Second.patch
 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
@@ -588,6 +616,7 @@ X-Mailer: X-MAILER-STRING
 
 Result: OK
 EOF
+"
 
 test_expect_success $PREREQ '--suppress-cc=cc' '
 	test_suppression cc
@@ -918,6 +947,7 @@ test_expect_success $PREREQ '--no-bcc overrides sendemail.bcc' '
 	! grep "RCPT TO:<other@ex.com>" stdout
 '
 
+test_expect_success $PREREQ 'setup expect' '
 cat >email-using-8bit <<EOF
 From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
 Message-Id: <bogus-message-id@example.com>
@@ -927,12 +957,15 @@ Subject: subject goes here
 
 Dieser deutsche Text enthält einen Umlaut!
 EOF
+'
 
+test_expect_success $PREREQ 'setup expect' '
 cat >content-type-decl <<EOF
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 EOF
+'
 
 test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
 	clean_fake_sendmail &&
@@ -970,6 +1003,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
 	test_cmp actual content-type-decl
 '
 
+test_expect_success $PREREQ 'setup expect' '
 cat >email-using-8bit <<EOF
 From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
 Message-Id: <bogus-message-id@example.com>
@@ -979,10 +1013,13 @@ Subject: Dieser Betreff enthält auch einen Umlaut!
 
 Nothing to see here.
 EOF
+'
 
+test_expect_success $PREREQ 'setup expect' '
 cat >expected <<EOF
 Subject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=
 EOF
+'
 
 test_expect_success $PREREQ '--8bit-encoding also treats subject' '
 	clean_fake_sendmail &&
-- 
1.7.2.1.338.gf2379

  parent reply	other threads:[~2010-08-13 20:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13 20:40 [PATCH 00/10] More test suite prerequisite cleanup Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 01/10] tests: Move FILEMODE prerequisite to lib-prereq-FILEMODE.sh Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 02/10] t/t3701-add-interactive.sh: change from skip_all=* to prereq skip Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 03/10] lib-patch-mode tests: " Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 04/10] t/t9600-cvsimport.sh: " Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 05/10] t/t9001-send-email.sh: Remove needless PROG=* assignment Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 06/10] t/t9001-send-email.sh: change from skip_all=* to prereq skip Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` Ævar Arnfjörð Bjarmason [this message]
2010-08-13 20:40 ` [PATCH 08/10] t/t7105-reset-patch.sh: Add a PERL prerequisite Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 09/10] t/t9601-cvsimport-vendor-branch.sh: " Ævar Arnfjörð Bjarmason
2010-08-13 20:40 ` [PATCH 10/10] t/t9602-cvsimport-branches-tags.sh: " Ævar Arnfjörð Bjarmason

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1281732013-18284-8-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).