* [PATCH 2/3] trailer: add tests for trailer.trimEmpty
@ 2015-02-07 13:11 Christian Couder
0 siblings, 0 replies; only message in thread
From: Christian Couder @ 2015-02-07 13:11 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
t/t7513-interpret-trailers.sh | 72 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/t/t7513-interpret-trailers.sh b/t/t7513-interpret-trailers.sh
index bd0ab46..066d00b 100755
--- a/t/t7513-interpret-trailers.sh
+++ b/t/t7513-interpret-trailers.sh
@@ -892,4 +892,76 @@ test_expect_success 'with no command and no key' '
test_cmp expected actual
'
+test_expect_success 'with trailer.trimEmpty set to true' '
+ git config trailer.trimEmpty true &&
+ cat >expected <<-EOF &&
+
+ sign: A U Thor <author@example.com>
+ Thanks-to: Johannes
+ EOF
+ git interpret-trailers --trailer "review:" \
+ --trailer "Thanks-to:Johannes" >actual <<-EOF
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'with trailer.trimEmpty set to false' '
+ git config trailer.trimEmpty false &&
+ sed -e "s/ Z\$/ /" >expected <<-EOF &&
+
+ review: Z
+ sign: A U Thor <author@example.com>
+ Thanks-to: Johannes
+ EOF
+ git interpret-trailers --trailer "review:" \
+ --trailer "Thanks-to:Johannes" >actual <<-EOF
+ EOF
+ test_cmp expected actual
+'
+
+test_expect_success 'with trailer.trimEmpty set to false and a message' '
+ cat complex_message_body >expected &&
+ sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+ Fixes: Z
+ Acked-by= Z
+ Reviewed-by: Z
+ Signed-off-by: Z
+ sign: A U Thor <author@example.com>
+ Thanks-to: Johannes
+ EOF
+ git interpret-trailers --trailer "review:" \
+ --trailer "Thanks-to:Johannes" complex_message >actual
+ test_cmp expected actual &&
+ git interpret-trailers --no-trim-empty --trailer "review:" \
+ --trailer "Thanks-to:Johannes" complex_message >actual
+ test_cmp expected actual
+'
+
+test_expect_success 'with trailer.trimEmpty set to 1 and a message' '
+ git config trailer.trimEmpty 1 &&
+ cat complex_message_body >expected &&
+ sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+ sign: A U Thor <author@example.com>
+ Thanks-to: Johannes
+ EOF
+ git interpret-trailers --trailer "review:" \
+ --trailer "Thanks-to:Johannes" complex_message >actual
+ test_cmp expected actual
+'
+
+test_expect_success 'with trailer.trimEmpty set to 1 and --no-trim-empty' '
+ cat complex_message_body >expected &&
+ sed -e "s/ Z\$/ /" >>expected <<-\EOF &&
+ Fixes: Z
+ Acked-by= Z
+ Reviewed-by: Z
+ Signed-off-by: Z
+ sign: A U Thor <author@example.com>
+ Thanks-to: Johannes
+ EOF
+ git interpret-trailers --no-trim-empty --trailer "review:" \
+ --trailer "Thanks-to:Johannes" complex_message >actual
+ test_cmp expected actual
+'
+
test_done
--
2.2.1.313.gcc831f2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-07 13:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-07 13:11 [PATCH 2/3] trailer: add tests for trailer.trimEmpty Christian Couder
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).