All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] format-patch: Fix antipatterns in tests
@ 2022-01-31 23:23 Jerry Zhang
  2022-01-31 23:23 ` [PATCH V3 2/2] patch-id: fix scan_hunk_header on diffs with 1 line of before/after Jerry Zhang
  2022-01-31 23:25 ` [PATCH V2 1/2] patch-id: Fix antipatterns in tests Jerry Zhang
  0 siblings, 2 replies; 11+ messages in thread
From: Jerry Zhang @ 2022-01-31 23:23 UTC (permalink / raw)
  To: git, gitster; +Cc: Jerry Zhang

Clean up the tests for format-patch by moving file preparation
tasks inside the test body and redirecting files directly into
stdin instead of using 'cat'.

Signed-off-by: Jerry Zhang <jerry@skydio.com>
---
 t/t4204-patch-id.sh | 64 ++++++++++++++++++++++-----------------------
 1 file changed, 31 insertions(+), 33 deletions(-)

diff --git a/t/t4204-patch-id.sh b/t/t4204-patch-id.sh
index 80f4a65b28..da60f5b472 100755
--- a/t/t4204-patch-id.sh
+++ b/t/t4204-patch-id.sh
@@ -164,42 +164,40 @@ test_expect_success 'patch-id respects config from subdir' '
 		cd subdir &&
 		test_patch_id irrelevant patchid.stable=true
 	)
 '
 
-cat >nonl <<\EOF
-diff --git i/a w/a
-index e69de29..2e65efe 100644
---- i/a
-+++ w/a
-@@ -0,0 +1 @@
-+a
-\ No newline at end of file
-diff --git i/b w/b
-index e69de29..6178079 100644
---- i/b
-+++ w/b
-@@ -0,0 +1 @@
-+b
-EOF
-
-cat >withnl <<\EOF
-diff --git i/a w/a
-index e69de29..7898192 100644
---- i/a
-+++ w/a
-@@ -0,0 +1 @@
-+a
-diff --git i/b w/b
-index e69de29..6178079 100644
---- i/b
-+++ w/b
-@@ -0,0 +1 @@
-+b
-EOF
-
 test_expect_success 'patch-id handles no-nl-at-eof markers' '
-	cat nonl | calc_patch_id nonl &&
-	cat withnl | calc_patch_id withnl &&
+	cat >nonl <<-EOF &&
+	diff --git i/a w/a
+	index e69de29..2e65efe 100644
+	--- i/a
+	+++ w/a
+	@@ -0,0 +1 @@
+	+a
+	\ No newline at end of file
+	diff --git i/b w/b
+	index e69de29..6178079 100644
+	--- i/b
+	+++ w/b
+	@@ -0,0 +1 @@
+	+b
+	EOF
+	cat >withnl <<-EOF &&
+	diff --git i/a w/a
+	index e69de29..7898192 100644
+	--- i/a
+	+++ w/a
+	@@ -0,0 +1 @@
+	+a
+	diff --git i/b w/b
+	index e69de29..6178079 100644
+	--- i/b
+	+++ w/b
+	@@ -0,0 +1 @@
+	+b
+	EOF
+	calc_patch_id nonl <nonl &&
+	calc_patch_id withnl <withnl &&
 	test_cmp patch-id_nonl patch-id_withnl
 '
 test_done
-- 
2.32.0.1314.g6ed4fcc4cc


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-02  4:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 23:23 [PATCH 1/2] format-patch: Fix antipatterns in tests Jerry Zhang
2022-01-31 23:23 ` [PATCH V3 2/2] patch-id: fix scan_hunk_header on diffs with 1 line of before/after Jerry Zhang
2022-01-31 23:52   ` [PATCH V4 " Jerry Zhang
2022-02-02  4:19     ` [PATCH V5 " Jerry Zhang
2022-01-31 23:25 ` [PATCH V2 1/2] patch-id: Fix antipatterns in tests Jerry Zhang
2022-01-31 23:36   ` Junio C Hamano
2022-01-31 23:52   ` [PATCH V3 " Jerry Zhang
2022-02-01 22:07     ` Johannes Sixt
2022-02-01 23:18       ` Junio C Hamano
2022-02-01 23:16     ` Junio C Hamano
2022-02-02  4:20     ` [PATCH V4 " Jerry Zhang

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.