Skip to content

Commit

Permalink
t9001: style modernisation phase #5
Browse files Browse the repository at this point in the history
Two general shell script codingstyles around here-text.

 - Quote the <<\END_OF_HERE_TEXT string when there is no parameter
   substitution going on to reduce cognitive load of the reader.

 - Indent the text with <<-\END_OF_HERE_TEXT when able to make it
   easier to spot boundaries of the tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Nov 25, 2014
1 parent ee756a8 commit 0720a51
Showing 1 changed file with 74 additions and 76 deletions.
150 changes: 74 additions & 76 deletions t/t9001-send-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ test_expect_success $PREREQ 'Send patches' '
'

test_expect_success $PREREQ 'setup expect' '
cat >expected <<\EOF
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
cat >expected <<-\EOF
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
'

test_expect_success $PREREQ 'Verify commandline' '
Expand All @@ -106,14 +106,14 @@ test_expect_success $PREREQ 'Send patches with --envelope-sender' '
'

test_expect_success $PREREQ 'setup expect' '
cat >expected <<\EOF
!patch@example.com!
!-i!
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
cat >expected <<-\EOF
!patch@example.com!
!-i!
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
'

test_expect_success $PREREQ 'Verify commandline' '
Expand All @@ -126,14 +126,14 @@ test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' '
'

test_expect_success $PREREQ 'setup expect' '
cat >expected <<\EOF
!nobody@example.com!
!-i!
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
cat >expected <<-\EOF
!nobody@example.com!
!-i!
!nobody@example.com!
!author@example.com!
!one@example.com!
!two@example.com!
EOF
'

test_expect_success $PREREQ 'Verify commandline' '
Expand Down Expand Up @@ -1192,7 +1192,7 @@ test_expect_success $PREREQ 'To headers from files reset each patch' '
'

test_expect_success $PREREQ 'setup expect' '
cat >email-using-8bit <<EOF
cat >email-using-8bit <<\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
Message-Id: <bogus-message-id@example.com>
From: author@example.com
Expand All @@ -1204,9 +1204,7 @@ EOF
'

test_expect_success $PREREQ 'setup expect' '
cat >expected <<EOF
Subject: subject goes here
EOF
echo "Subject: subject goes here" >expected
'

test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '
Expand All @@ -1221,11 +1219,11 @@ test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '
'

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
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' '
Expand Down Expand Up @@ -1265,21 +1263,21 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
'

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>
From: author@example.com
Date: Sat, 12 Jun 2010 15:53:58 +0200
Subject: Dieser Betreff enthält auch einen Umlaut!
Nothing to see here.
EOF
cat >email-using-8bit <<-\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
Message-Id: <bogus-message-id@example.com>
From: author@example.com
Date: Sat, 12 Jun 2010 15:53:58 +0200
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
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' '
Expand All @@ -1294,16 +1292,16 @@ test_expect_success $PREREQ '--8bit-encoding also treats subject' '
'

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>
From: A U Thor <author@example.com>
Date: Sat, 12 Jun 2010 15:53:58 +0200
Content-Type: text/plain; charset=UTF-8
Subject: Nothing to see here.
Dieser Betreff enthält auch einen Umlaut!
EOF
cat >email-using-8bit <<-\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
Message-Id: <bogus-message-id@example.com>
From: A U Thor <author@example.com>
Date: Sat, 12 Jun 2010 15:53:58 +0200
Content-Type: text/plain; charset=UTF-8
Subject: Nothing to see here.
Dieser Betreff enthält auch einen Umlaut!
EOF
'

test_expect_success $PREREQ 'sendemail.transferencoding=7bit fails on 8bit data' '
Expand Down Expand Up @@ -1343,9 +1341,9 @@ test_expect_success $PREREQ 'sendemail.transferencoding=8bit' '
'

test_expect_success $PREREQ 'setup expect' '
cat >expected <<EOF
Dieser Betreff enth=C3=A4lt auch einen Umlaut!
EOF
cat >expected <<-\EOF
Dieser Betreff enth=C3=A4lt auch einen Umlaut!
EOF
'

test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printable' '
Expand All @@ -1360,9 +1358,9 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printab
'

test_expect_success $PREREQ 'setup expect' '
cat >expected <<EOF
RGllc2VyIEJldHJlZmYgZW50aMOkbHQgYXVjaCBlaW5lbiBVbWxhdXQhCg==
EOF
cat >expected <<-\EOF
RGllc2VyIEJldHJlZmYgZW50aMOkbHQgYXVjaCBlaW5lbiBVbWxhdXQhCg==
EOF
'

test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
Expand All @@ -1377,18 +1375,18 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' '
'

test_expect_success $PREREQ 'setup expect' '
cat >email-using-qp <<EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
Message-Id: <bogus-message-id@example.com>
From: A U Thor <author@example.com>
Date: Sat, 12 Jun 2010 15:53:58 +0200
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Subject: Nothing to see here.
cat >email-using-qp <<-\EOF
From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
Message-Id: <bogus-message-id@example.com>
From: A U Thor <author@example.com>
Date: Sat, 12 Jun 2010 15:53:58 +0200
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
Subject: Nothing to see here.
Dieser Betreff enth=C3=A4lt auch einen Umlaut!
EOF
Dieser Betreff enth=C3=A4lt auch einen Umlaut!
EOF
'

test_expect_success $PREREQ 'convert from quoted-printable to base64' '
Expand Down Expand Up @@ -1416,9 +1414,9 @@ EOF
"

test_expect_success $PREREQ 'setup expect' '
cat >expected <<EOF
Look, I have a CRLF and an =3D sign!=0D
EOF
cat >expected <<-\EOF
Look, I have a CRLF and an =3D sign!=0D
EOF
'

test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printable' '
Expand All @@ -1433,9 +1431,9 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printabl
'

test_expect_success $PREREQ 'setup expect' '
cat >expected <<EOF
TG9vaywgSSBoYXZlIGEgQ1JMRiBhbmQgYW4gPSBzaWduIQ0K
EOF
cat >expected <<-\EOF
TG9vaywgSSBoYXZlIGEgQ1JMRiBhbmQgYW4gPSBzaWduIQ0K
EOF
'

test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' '
Expand Down

0 comments on commit 0720a51

Please sign in to comment.