Thread (8 messages) 8 messages, 2 authors, 2022-02-02

Re: [PATCH V3 1/2] patch-id: Fix antipatterns in tests

From: Johannes Sixt <hidden>
Date: 2022-02-01 22:07:36

Am 01.02.22 um 00:52 schrieb Jerry Zhang:
Clean up the tests for patch-id by moving file preparation
tasks inside the test body and redirecting files directly into
stdin instead of using 'cat'.
You announce that `cat` is about to be removed...
 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' &&
... but it is still here...
+	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' &&
... and here, although...
+	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 &&
... you could in fact just redirect the here-documents into these commands.
 	test_cmp patch-id_nonl patch-id_withnl
 '
 test_done
-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help