[PATCH 2/3] trailer: add tests for trailer.trimEmpty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Christian Couder <chriscool@xxxxxxxxxxxxx>
---
 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@xxxxxxxxxxx>
+		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@xxxxxxxxxxx>
+		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@xxxxxxxxxxx>
+		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@xxxxxxxxxxx>
+		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@xxxxxxxxxxx>
+		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


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]