All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: git@vger.kernel.org
Cc: Jeff King <peff@peff.net>, Eric Sunshine <ericsunshine@gmail.com>
Subject: [PATCH 08/19] tests: simplify construction of large blocks of text
Date: Thu,  9 Dec 2021 00:11:04 -0500	[thread overview]
Message-ID: <20211209051115.52629-9-sunshine@sunshineco.com> (raw)
In-Reply-To: <20211209051115.52629-1-sunshine@sunshineco.com>

Take advantage of here-docs to create large blocks of text rather than
using a series of `echo` statements. Not only are here-docs a natural
fit for such a task, but there is less opportunity for a broken
&&-chain.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---
 t/t0021-conversion.sh        |  44 ++---
 t/t4106-apply-stdin.sh       |   5 +-
 t/t5510-fetch.sh             |  10 +-
 t/t5515-fetch-merge-logic.sh |  22 +--
 t/t6406-merge-attr.sh        |   8 +-
 t/t6411-merge-filemode.sh    |   8 +-
 t/t7810-grep.sh              | 310 +++++++++++++++++------------------
 7 files changed, 205 insertions(+), 202 deletions(-)

diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 33dfc9cd56..1a1a69ad92 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -118,17 +118,17 @@ test_expect_success check '
 # If an expanded ident ever gets into the repository, we want to make sure that
 # it is collapsed before being expanded again on checkout
 test_expect_success expanded_in_repo '
-	{
-		echo "File with expanded keywords"
-		echo "\$Id\$"
-		echo "\$Id:\$"
-		echo "\$Id: 0000000000000000000000000000000000000000 \$"
-		echo "\$Id: NoSpaceAtEnd\$"
-		echo "\$Id:NoSpaceAtFront \$"
-		echo "\$Id:NoSpaceAtEitherEnd\$"
-		echo "\$Id: NoTerminatingSymbol"
-		echo "\$Id: Foreign Commit With Spaces \$"
-	} >expanded-keywords.0 &&
+	cat >expanded-keywords.0 <<-\EOF &&
+	File with expanded keywords
+	$Id$
+	$Id:$
+	$Id: 0000000000000000000000000000000000000000 $
+	$Id: NoSpaceAtEnd$
+	$Id:NoSpaceAtFront $
+	$Id:NoSpaceAtEitherEnd$
+	$Id: NoTerminatingSymbol
+	$Id: Foreign Commit With Spaces $
+	EOF
 
 	{
 		cat expanded-keywords.0 &&
@@ -139,17 +139,17 @@ test_expect_success expanded_in_repo '
 	git commit -m "File with keywords expanded" &&
 	id=$(git rev-parse --verify :expanded-keywords) &&
 
-	{
-		echo "File with expanded keywords"
-		echo "\$Id: $id \$"
-		echo "\$Id: $id \$"
-		echo "\$Id: $id \$"
-		echo "\$Id: $id \$"
-		echo "\$Id: $id \$"
-		echo "\$Id: $id \$"
-		echo "\$Id: NoTerminatingSymbol"
-		echo "\$Id: Foreign Commit With Spaces \$"
-	} >expected-output.0 &&
+	cat >expected-output.0 <<-EOF &&
+	File with expanded keywords
+	\$Id: $id \$
+	\$Id: $id \$
+	\$Id: $id \$
+	\$Id: $id \$
+	\$Id: $id \$
+	\$Id: $id \$
+	\$Id: NoTerminatingSymbol
+	\$Id: Foreign Commit With Spaces \$
+	EOF
 	{
 		cat expected-output.0 &&
 		printf "\$Id: NoTerminatingSymbolAtEOF"
diff --git a/t/t4106-apply-stdin.sh b/t/t4106-apply-stdin.sh
index 72467a1e8e..1e70810b9c 100755
--- a/t/t4106-apply-stdin.sh
+++ b/t/t4106-apply-stdin.sh
@@ -18,7 +18,10 @@ test_expect_success 'git apply --numstat - < patch' '
 '
 
 test_expect_success 'git apply --numstat - < patch patch' '
-	for i in 1 2; do echo "1	1	text"; done >expect &&
+	cat >expect <<-\EOF &&
+	1	1	text
+	1	1	text
+	EOF
 	git apply --numstat - < patch patch >actual &&
 	test_cmp expect actual
 '
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index a0faf0dd94..1892d6615a 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -40,11 +40,11 @@ test_expect_success "clone and setup child repos" '
 		git config branch.main.remote two &&
 		git config branch.main.merge refs/heads/one &&
 		mkdir -p .git/remotes &&
-		{
-			echo "URL: ../two/.git/"
-			echo "Pull: refs/heads/main:refs/heads/two"
-			echo "Pull: refs/heads/one:refs/heads/one"
-		} >.git/remotes/two
+		cat >.git/remotes/two <<-\EOF
+		URL: ../two/.git/
+		Pull: refs/heads/main:refs/heads/two
+		Pull: refs/heads/one:refs/heads/one
+		EOF
 	) &&
 	git clone . bundle &&
 	git clone . seven
diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index 50f14101c5..9d440e2821 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -105,19 +105,19 @@ test_expect_success setup '
 	remotes="$remotes config-glob" &&
 
 	mkdir -p .git/remotes &&
-	{
-		echo "URL: ../.git/"
-		echo "Pull: refs/heads/main:remotes/rem/main"
-		echo "Pull: refs/heads/one:remotes/rem/one"
-		echo "Pull: two:remotes/rem/two"
-		echo "Pull: refs/heads/three:remotes/rem/three"
-	} >.git/remotes/remote-explicit &&
+	cat >.git/remotes/remote-explicit <<-\EOF &&
+	URL: ../.git/
+	Pull: refs/heads/main:remotes/rem/main
+	Pull: refs/heads/one:remotes/rem/one
+	Pull: two:remotes/rem/two
+	Pull: refs/heads/three:remotes/rem/three
+	EOF
 	remotes="$remotes remote-explicit" &&
 
-	{
-		echo "URL: ../.git/"
-		echo "Pull: refs/heads/*:refs/remotes/rem/*"
-	} >.git/remotes/remote-glob &&
+	cat >.git/remotes/remote-glob <<-\EOF &&
+	URL: ../.git/
+	Pull: refs/heads/*:refs/remotes/rem/*
+	EOF
 	remotes="$remotes remote-glob" &&
 
 	mkdir -p .git/branches &&
diff --git a/t/t6406-merge-attr.sh b/t/t6406-merge-attr.sh
index 8494645837..57e6af5eaa 100755
--- a/t/t6406-merge-attr.sh
+++ b/t/t6406-merge-attr.sh
@@ -62,10 +62,10 @@ test_expect_success setup '
 
 test_expect_success merge '
 
-	{
-		echo "binary -merge"
-		echo "union merge=union"
-	} >.gitattributes &&
+	cat >.gitattributes <<-\EOF &&
+	binary -merge
+	union merge=union
+	EOF
 
 	if git merge main
 	then
diff --git a/t/t6411-merge-filemode.sh b/t/t6411-merge-filemode.sh
index f54c915d6a..6ae2489286 100755
--- a/t/t6411-merge-filemode.sh
+++ b/t/t6411-merge-filemode.sh
@@ -51,10 +51,10 @@ test_expect_success 'set up mode change in both branches' '
 	: >file2 &&
 	git add file2 &&
 	git commit -m b2 &&
-	{
-		echo "100755 $H 2	file2"
-		echo "100644 $H 3	file2"
-	} >expect
+	cat >expect <<-EOF
+	100755 $H 2	file2
+	100644 $H 3	file2
+	EOF
 '
 
 do_both_modes () {
diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 6b6423a07c..424c31c328 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -31,28 +31,28 @@ int main(int argc, const char **argv)
 EOF
 
 test_expect_success setup '
-	{
-		echo foo mmap bar
-		echo foo_mmap bar
-		echo foo_mmap bar mmap
-		echo foo mmap bar_mmap
-		echo foo_mmap bar mmap baz
-	} >file &&
-	{
-		echo Hello world
-		echo HeLLo world
-		echo Hello_world
-		echo HeLLo_world
-	} >hello_world &&
-	{
-		echo "a+b*c"
-		echo "a+bc"
-		echo "abc"
-	} >ab &&
-	{
-		echo d &&
-		echo 0
-	} >d0 &&
+	cat >file <<-\EOF &&
+	foo mmap bar
+	foo_mmap bar
+	foo_mmap bar mmap
+	foo mmap bar_mmap
+	foo_mmap bar mmap baz
+	EOF
+	cat >hello_world <<-\EOF &&
+	Hello world
+	HeLLo world
+	Hello_world
+	HeLLo_world
+	EOF
+	cat >ab <<-\EOF &&
+	a+b*c
+	a+bc
+	abc
+	EOF
+	cat >d0 <<-\EOF &&
+	d
+	0
+	EOF
 	echo vvv >v &&
 	echo ww w >w &&
 	echo x x xx x >x &&
@@ -63,13 +63,13 @@ test_expect_success setup '
 	echo vvv >t/v &&
 	mkdir t/a &&
 	echo vvv >t/a/v &&
-	{
-		echo "line without leading space1"
-		echo " line with leading space1"
-		echo " line with leading space2"
-		echo " line with leading space3"
-		echo "line without leading space2"
-	} >space &&
+	qz_to_tab_space >space <<-\EOF &&
+	line without leading space1
+	Zline with leading space1
+	Zline with leading space2
+	Zline with leading space3
+	line without leading space2
+	EOF
 	cat >hello.ps1 <<-\EOF &&
 	# No-op.
 	function dummy() {}
@@ -106,129 +106,129 @@ do
 	esac
 
 	test_expect_success "grep -w $L" '
-		{
-			echo ${HC}file:1:foo mmap bar
-			echo ${HC}file:3:foo_mmap bar mmap
-			echo ${HC}file:4:foo mmap bar_mmap
-			echo ${HC}file:5:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:1:foo mmap bar
+		${HC}file:3:foo_mmap bar mmap
+		${HC}file:4:foo mmap bar_mmap
+		${HC}file:5:foo_mmap bar mmap baz
+		EOF
 		git -c grep.linenumber=false grep -n -w -e mmap $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L (with --column)" '
-		{
-			echo ${HC}file:5:foo mmap bar
-			echo ${HC}file:14:foo_mmap bar mmap
-			echo ${HC}file:5:foo mmap bar_mmap
-			echo ${HC}file:14:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:5:foo mmap bar
+		${HC}file:14:foo_mmap bar mmap
+		${HC}file:5:foo mmap bar_mmap
+		${HC}file:14:foo_mmap bar mmap baz
+		EOF
 		git grep --column -w -e mmap $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L (with --column, extended OR)" '
-		{
-			echo ${HC}file:14:foo_mmap bar mmap
-			echo ${HC}file:19:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:14:foo_mmap bar mmap
+		${HC}file:19:foo_mmap bar mmap baz
+		EOF
 		git grep --column -w -e mmap$ --or -e baz $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L (with --column, --invert-match)" '
-		{
-			echo ${HC}file:1:foo mmap bar
-			echo ${HC}file:1:foo_mmap bar
-			echo ${HC}file:1:foo_mmap bar mmap
-			echo ${HC}file:1:foo mmap bar_mmap
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:1:foo mmap bar
+		${HC}file:1:foo_mmap bar
+		${HC}file:1:foo_mmap bar mmap
+		${HC}file:1:foo mmap bar_mmap
+		EOF
 		git grep --column --invert-match -w -e baz $H -- file >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep $L (with --column, --invert-match, extended OR)" '
-		{
-			echo ${HC}hello_world:6:HeLLo_world
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}hello_world:6:HeLLo_world
+		EOF
 		git grep --column --invert-match -e ll --or --not -e _ $H -- hello_world \
 			>actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep $L (with --column, --invert-match, extended AND)" '
-		{
-			echo ${HC}hello_world:3:Hello world
-			echo ${HC}hello_world:3:Hello_world
-			echo ${HC}hello_world:6:HeLLo_world
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}hello_world:3:Hello world
+		${HC}hello_world:3:Hello_world
+		${HC}hello_world:6:HeLLo_world
+		EOF
 		git grep --column --invert-match --not -e _ --and --not -e ll $H -- hello_world \
 			>actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep $L (with --column, double-negation)" '
-		{
-			echo ${HC}file:1:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:1:foo_mmap bar mmap baz
+		EOF
 		git grep --column --not \( --not -e foo --or --not -e baz \) $H -- file \
 			>actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L (with --column, -C)" '
-		{
-			echo ${HC}file:5:foo mmap bar
-			echo ${HC}file-foo_mmap bar
-			echo ${HC}file:14:foo_mmap bar mmap
-			echo ${HC}file:5:foo mmap bar_mmap
-			echo ${HC}file:14:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:5:foo mmap bar
+		${HC}file-foo_mmap bar
+		${HC}file:14:foo_mmap bar mmap
+		${HC}file:5:foo mmap bar_mmap
+		${HC}file:14:foo_mmap bar mmap baz
+		EOF
 		git grep --column -w -C1 -e mmap $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L (with --line-number, --column)" '
-		{
-			echo ${HC}file:1:5:foo mmap bar
-			echo ${HC}file:3:14:foo_mmap bar mmap
-			echo ${HC}file:4:5:foo mmap bar_mmap
-			echo ${HC}file:5:14:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:1:5:foo mmap bar
+		${HC}file:3:14:foo_mmap bar mmap
+		${HC}file:4:5:foo mmap bar_mmap
+		${HC}file:5:14:foo_mmap bar mmap baz
+		EOF
 		git grep -n --column -w -e mmap $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L (with non-extended patterns, --column)" '
-		{
-			echo ${HC}file:5:foo mmap bar
-			echo ${HC}file:10:foo_mmap bar
-			echo ${HC}file:10:foo_mmap bar mmap
-			echo ${HC}file:5:foo mmap bar_mmap
-			echo ${HC}file:10:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:5:foo mmap bar
+		${HC}file:10:foo_mmap bar
+		${HC}file:10:foo_mmap bar mmap
+		${HC}file:5:foo mmap bar_mmap
+		${HC}file:10:foo_mmap bar mmap baz
+		EOF
 		git grep --column -w -e bar -e mmap $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L" '
-		{
-			echo ${HC}file:1:foo mmap bar
-			echo ${HC}file:3:foo_mmap bar mmap
-			echo ${HC}file:4:foo mmap bar_mmap
-			echo ${HC}file:5:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:1:foo mmap bar
+		${HC}file:3:foo_mmap bar mmap
+		${HC}file:4:foo mmap bar_mmap
+		${HC}file:5:foo_mmap bar mmap baz
+		EOF
 		git -c grep.linenumber=true grep -w -e mmap $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L" '
-		{
-			echo ${HC}file:foo mmap bar
-			echo ${HC}file:foo_mmap bar mmap
-			echo ${HC}file:foo mmap bar_mmap
-			echo ${HC}file:foo_mmap bar mmap baz
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:foo mmap bar
+		${HC}file:foo_mmap bar mmap
+		${HC}file:foo mmap bar_mmap
+		${HC}file:foo_mmap bar mmap baz
+		EOF
 		git -c grep.linenumber=true grep --no-line-number -w -e mmap $H >actual &&
 		test_cmp expected actual
 	'
@@ -239,17 +239,17 @@ do
 	'
 
 	test_expect_success "grep -w $L (x)" '
-		{
-			echo ${HC}x:1:x x xx x
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}x:1:x x xx x
+		EOF
 		git grep -n -w -e "x xx* x" $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep -w $L (y-1)" '
-		{
-			echo ${HC}y:1:y yy
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}y:1:y yy
+		EOF
 		git grep -n -w -e "^y" $H >actual &&
 		test_cmp expected actual
 	'
@@ -277,16 +277,16 @@ do
 	'
 
 	test_expect_success "grep $L (with --column, --only-matching)" '
-		{
-			echo ${HC}file:1:5:mmap
-			echo ${HC}file:2:5:mmap
-			echo ${HC}file:3:5:mmap
-			echo ${HC}file:3:13:mmap
-			echo ${HC}file:4:5:mmap
-			echo ${HC}file:4:13:mmap
-			echo ${HC}file:5:5:mmap
-			echo ${HC}file:5:13:mmap
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}file:1:5:mmap
+		${HC}file:2:5:mmap
+		${HC}file:3:5:mmap
+		${HC}file:3:13:mmap
+		${HC}file:4:5:mmap
+		${HC}file:4:13:mmap
+		${HC}file:5:5:mmap
+		${HC}file:5:13:mmap
+		EOF
 		git grep --column -n -o -e mmap $H >actual &&
 		test_cmp expected actual
 	'
@@ -320,11 +320,11 @@ do
 	'
 
 	test_expect_success "grep --max-depth -1 $L" '
-		{
-			echo ${HC}t/a/v:1:vvv
-			echo ${HC}t/v:1:vvv
-			echo ${HC}v:1:vvv
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}t/a/v:1:vvv
+		${HC}t/v:1:vvv
+		${HC}v:1:vvv
+		EOF
 		git grep --max-depth -1 -n -e vvv $H >actual &&
 		test_cmp expected actual &&
 		git grep --recursive -n -e vvv $H >actual &&
@@ -332,9 +332,9 @@ do
 	'
 
 	test_expect_success "grep --max-depth 0 $L" '
-		{
-			echo ${HC}v:1:vvv
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}v:1:vvv
+		EOF
 		git grep --max-depth 0 -n -e vvv $H >actual &&
 		test_cmp expected actual &&
 		git grep --no-recursive -n -e vvv $H >actual &&
@@ -342,11 +342,11 @@ do
 	'
 
 	test_expect_success "grep --max-depth 0 -- '*' $L" '
-		{
-			echo ${HC}t/a/v:1:vvv
-			echo ${HC}t/v:1:vvv
-			echo ${HC}v:1:vvv
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}t/a/v:1:vvv
+		${HC}t/v:1:vvv
+		${HC}v:1:vvv
+		EOF
 		git grep --max-depth 0 -n -e vvv $H -- "*" >actual &&
 		test_cmp expected actual &&
 		git grep --no-recursive -n -e vvv $H -- "*" >actual &&
@@ -354,18 +354,18 @@ do
 	'
 
 	test_expect_success "grep --max-depth 1 $L" '
-		{
-			echo ${HC}t/v:1:vvv
-			echo ${HC}v:1:vvv
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}t/v:1:vvv
+		${HC}v:1:vvv
+		EOF
 		git grep --max-depth 1 -n -e vvv $H >actual &&
 		test_cmp expected actual
 	'
 
 	test_expect_success "grep --max-depth 0 -- t $L" '
-		{
-			echo ${HC}t/v:1:vvv
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}t/v:1:vvv
+		EOF
 		git grep --max-depth 0 -n -e vvv $H -- t >actual &&
 		test_cmp expected actual &&
 		git grep --no-recursive -n -e vvv $H -- t >actual &&
@@ -373,10 +373,10 @@ do
 	'
 
 	test_expect_success "grep --max-depth 0 -- . t $L" '
-		{
-			echo ${HC}t/v:1:vvv
-			echo ${HC}v:1:vvv
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}t/v:1:vvv
+		${HC}v:1:vvv
+		EOF
 		git grep --max-depth 0 -n -e vvv $H -- . t >actual &&
 		test_cmp expected actual &&
 		git grep --no-recursive -n -e vvv $H -- . t >actual &&
@@ -384,10 +384,10 @@ do
 	'
 
 	test_expect_success "grep --max-depth 0 -- t . $L" '
-		{
-			echo ${HC}t/v:1:vvv
-			echo ${HC}v:1:vvv
-		} >expected &&
+		cat >expected <<-EOF &&
+		${HC}t/v:1:vvv
+		${HC}v:1:vvv
+		EOF
 		git grep --max-depth 0 -n -e vvv $H -- t . >actual &&
 		test_cmp expected actual &&
 		git grep --no-recursive -n -e vvv $H -- t . >actual &&
@@ -1314,10 +1314,10 @@ test_expect_success PCRE 'grep -P pattern with grep.extendedRegexp=true' '
 '
 
 test_expect_success PCRE 'grep -P -v pattern' '
-	{
-		echo "ab:a+b*c"
-		echo "ab:a+bc"
-	} >expected &&
+	cat >expected <<-\EOF &&
+	ab:a+b*c
+	ab:a+bc
+	EOF
 	git grep -P -v "abc" ab >actual &&
 	test_cmp expected actual
 '
@@ -1331,10 +1331,10 @@ test_expect_success PCRE 'grep -P -i pattern' '
 '
 
 test_expect_success PCRE 'grep -P -w pattern' '
-	{
-		echo "hello_world:Hello world"
-		echo "hello_world:HeLLo world"
-	} >expected &&
+	cat >expected <<-\EOF &&
+	hello_world:Hello world
+	hello_world:HeLLo world
+	EOF
 	git grep -P -w "He((?i)ll)o" hello_world >actual &&
 	test_cmp expected actual
 '
@@ -1469,10 +1469,10 @@ test_expect_success 'grep -F pattern with grep.patternType=basic' '
 '
 
 test_expect_success 'grep -G pattern with grep.patternType=fixed' '
-	{
-		echo "ab:a+b*c"
-		echo "ab:a+bc"
-	} >expected &&
+	cat >expected <<-\EOF &&
+	ab:a+b*c
+	ab:a+bc
+	EOF
 	git \
 		-c grep.patterntype=fixed \
 		grep -G "a+b" ab >actual &&
@@ -1480,11 +1480,11 @@ test_expect_success 'grep -G pattern with grep.patternType=fixed' '
 '
 
 test_expect_success 'grep -E pattern with grep.patternType=fixed' '
-	{
-		echo "ab:a+b*c"
-		echo "ab:a+bc"
-		echo "ab:abc"
-	} >expected &&
+	cat >expected <<-\EOF &&
+	ab:a+b*c
+	ab:a+bc
+	ab:abc
+	EOF
 	git \
 		-c grep.patterntype=fixed \
 		grep -E "a+" ab >actual &&
-- 
2.34.1.307.g9b7440fafd


  parent reply	other threads:[~2021-12-09  5:12 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  5:10 [PATCH 00/19] tests: fix broken &&-chains & abort loops on error Eric Sunshine
2021-12-09  5:10 ` [PATCH 01/19] t/lib-pager: use sane_unset() to avoid breaking &&-chain Eric Sunshine
2021-12-09  5:10 ` [PATCH 02/19] t1010: fix unnoticed failure on Windows Eric Sunshine
2021-12-09 16:27   ` Elijah Newren
2021-12-09 16:45     ` Eric Sunshine
2021-12-09  5:10 ` [PATCH 03/19] t1020: avoid aborting entire test script when one test fails Eric Sunshine
2021-12-09  5:11 ` [PATCH 04/19] t4202: clarify intent by creating expected content less cleverly Eric Sunshine
2021-12-10  9:09   ` Jeff King
2021-12-09  5:11 ` [PATCH 05/19] t5516: drop unnecessary subshell and command invocation Eric Sunshine
2021-12-10  9:10   ` Jeff King
2021-12-09  5:11 ` [PATCH 06/19] t6300: make `%(raw:size) --shell` test more robust Eric Sunshine
2021-12-10  9:14   ` Jeff King
2021-12-09  5:11 ` [PATCH 07/19] t9107: use shell parameter expansion to avoid breaking &&-chain Eric Sunshine
2021-12-09  5:11 ` Eric Sunshine [this message]
2021-12-09  5:11 ` [PATCH 09/19] tests: use test_write_lines() to generate line-oriented output Eric Sunshine
2021-12-10  9:22   ` Jeff King
2021-12-11  6:59     ` Eric Sunshine
2021-12-09  5:11 ` [PATCH 10/19] tests: fix broken &&-chains in compound statements Eric Sunshine
2021-12-09  5:11 ` [PATCH 11/19] tests: fix broken &&-chains in `$(...)` command substitutions Eric Sunshine
2021-12-09 16:44   ` Elijah Newren
2021-12-09 16:53     ` Eric Sunshine
2021-12-09 16:57       ` Elijah Newren
2021-12-10  9:27       ` Jeff King
2021-12-09  5:11 ` [PATCH 12/19] tests: fix broken &&-chains in `{...}` groups Eric Sunshine
2021-12-10  9:29   ` Jeff King
2021-12-11  7:14     ` Eric Sunshine
2021-12-10  9:38   ` Fabian Stelzer
2021-12-11  7:32     ` Eric Sunshine
2021-12-09  5:11 ` [PATCH 13/19] tests: apply modern idiom for signaling test failure Eric Sunshine
2021-12-10  9:32   ` Jeff King
2021-12-11  7:47     ` Eric Sunshine
2021-12-09  5:11 ` [PATCH 14/19] tests: apply modern idiom for exiting loop upon failure Eric Sunshine
2021-12-10  9:36   ` Jeff King
2021-12-09  5:11 ` [PATCH 15/19] tests: simplify by dropping unnecessary `for` loops Eric Sunshine
2021-12-09 16:50   ` Elijah Newren
2021-12-09  5:11 ` [PATCH 16/19] t0000-t3999: detect and signal failure within loop Eric Sunshine
2021-12-09  5:11 ` [PATCH 17/19] t4000-t4999: " Eric Sunshine
2021-12-10  9:53   ` Fabian Stelzer
2021-12-11  8:06     ` Eric Sunshine
2021-12-09  5:11 ` [PATCH 18/19] t5000-t5999: " Eric Sunshine
2021-12-09  5:11 ` [PATCH 19/19] t6000-t9999: " Eric Sunshine
2021-12-09 17:02 ` [PATCH 00/19] tests: fix broken &&-chains & abort loops on error Elijah Newren
2021-12-09 19:17   ` Eric Sunshine
2021-12-10  9:38     ` Jeff King
2021-12-10  9:57       ` Fabian Stelzer
2021-12-11  8:16         ` Eric Sunshine
2021-12-11  9:58 ` [PATCH v1.1 2/19] t1010: fix unnoticed failure on Windows Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211209051115.52629-9-sunshine@sunshineco.com \
    --to=sunshine@sunshineco.com \
    --cc=ericsunshine@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.