git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t4014: strengthen search patterns
@ 2017-09-19 12:46 Kaartic Sivaraam
  2017-09-20  2:50 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Kaartic Sivaraam @ 2017-09-19 12:46 UTC (permalink / raw)
  To: git

The regex patterns for some failing test cases were a bit loose
giving way for a few incorrect outputs being accepted as correct
outputs.

To avoid such incorrect outputs from being flagged as correct ones
use fixed string matches when possible and strengthen regex when
it's not.

Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
---
 t/t4014-format-patch.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 482112ca339f0..7dff7996c9e1f 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -163,7 +163,7 @@ test_expect_failure 'additional command line cc (rfc822)' '
 	git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
 	git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
 	grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch5 &&
-	grep "^ *\"S. E. Cipient\" <scipient@example.com>\$" patch5
+	grep "^ *\"S\. E\. Cipient\" <scipient@example\.com>\$" patch5
 '
 
 test_expect_success 'command line headers' '
@@ -191,13 +191,13 @@ test_expect_success 'command line To: header (ascii)' '
 test_expect_failure 'command line To: header (rfc822)' '
 
 	git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
-	grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" patch8
+	grep -F "To: \"R. E. Cipient\" <rcipient@example.com>" patch8
 '
 
 test_expect_failure 'command line To: header (rfc2047)' '
 
 	git format-patch --to="R Ä Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
-	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch8
+	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example\.com>\$" patch8
 '
 
 test_expect_success 'configuration To: header (ascii)' '
@@ -211,14 +211,14 @@ test_expect_failure 'configuration To: header (rfc822)' '
 
 	git config format.to "R. E. Cipient <rcipient@example.com>" &&
 	git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
-	grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" patch9
+	grep -F "To: \"R. E. Cipient\" <rcipient@example.com>" patch9
 '
 
 test_expect_failure 'configuration To: header (rfc2047)' '
 
 	git config format.to "R Ä Cipient <rcipient@example.com>" &&
 	git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
-	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch9
+	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example\.com>\$" patch9
 '
 
 # check_patch <patch>: Verify that <patch> looks like a half-sane

--
https://github.com/git/git/pull/406

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

* Re: [PATCH] t4014: strengthen search patterns
  2017-09-19 12:46 [PATCH] t4014: strengthen search patterns Kaartic Sivaraam
@ 2017-09-20  2:50 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2017-09-20  2:50 UTC (permalink / raw)
  To: Kaartic Sivaraam; +Cc: git

Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> writes:

> The regex patterns for some failing test cases were a bit loose
> giving way for a few incorrect outputs being accepted as correct
> outputs.

If these were part of scripted Porcelain that needs to take any
end-user input, then having '.' that are meant to match only a dot
is a bug, but I personally do not think it is worth the patch noise
to quote them, when we _know_ (after all, we are in control of the
data we use for these tests) there is no other lines that would
match these patterns.



> To avoid such incorrect outputs from being flagged as correct ones
> use fixed string matches when possible and strengthen regex when
> it's not.
>
> Signed-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
> ---
>  t/t4014-format-patch.sh | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index 482112ca339f0..7dff7996c9e1f 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -163,7 +163,7 @@ test_expect_failure 'additional command line cc (rfc822)' '
>  	git config --replace-all format.headers "Cc: R E Cipient <rcipient@example.com>" &&
>  	git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
>  	grep "^Cc: R E Cipient <rcipient@example.com>,\$" patch5 &&
> -	grep "^ *\"S. E. Cipient\" <scipient@example.com>\$" patch5
> +	grep "^ *\"S\. E\. Cipient\" <scipient@example\.com>\$" patch5
>  '
>  
>  test_expect_success 'command line headers' '
> @@ -191,13 +191,13 @@ test_expect_success 'command line To: header (ascii)' '
>  test_expect_failure 'command line To: header (rfc822)' '
>  
>  	git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
> -	grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" patch8
> +	grep -F "To: \"R. E. Cipient\" <rcipient@example.com>" patch8
>  '
>  
>  test_expect_failure 'command line To: header (rfc2047)' '
>  
>  	git format-patch --to="R Ä Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
> -	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch8
> +	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example\.com>\$" patch8
>  '
>  
>  test_expect_success 'configuration To: header (ascii)' '
> @@ -211,14 +211,14 @@ test_expect_failure 'configuration To: header (rfc822)' '
>  
>  	git config format.to "R. E. Cipient <rcipient@example.com>" &&
>  	git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
> -	grep "^To: \"R. E. Cipient\" <rcipient@example.com>\$" patch9
> +	grep -F "To: \"R. E. Cipient\" <rcipient@example.com>" patch9
>  '
>  
>  test_expect_failure 'configuration To: header (rfc2047)' '
>  
>  	git config format.to "R Ä Cipient <rcipient@example.com>" &&
>  	git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
> -	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example.com>\$" patch9
> +	grep "^To: =?UTF-8?q?R=20=C3=84=20Cipient?= <rcipient@example\.com>\$" patch9
>  '
>  
>  # check_patch <patch>: Verify that <patch> looks like a half-sane
>
> --
> https://github.com/git/git/pull/406

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

end of thread, other threads:[~2017-09-20  2:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 12:46 [PATCH] t4014: strengthen search patterns Kaartic Sivaraam
2017-09-20  2:50 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).