Re: [PATCH] send-email: add test for Linux's get_maintainer.pl

2018-01-05 Thread Junio C Hamano
Matthieu Moy  writes:

> Alex Bennée  writes:
>
>> I think you need to apply Eric's suggestions from:
>>
>>   From: Eric Sunshine 
>>   Date: Sat, 18 Nov 2017 21:54:46 -0500
>>   Message-ID: 
>> 
>
> Indeed. I'm squashing this into the patch:
>
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index f126177..d13d8c3 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -173,8 +173,7 @@ test_expect_success $PREREQ 'cc trailer with various 
> syntax' '
>  '
>  
>  test_expect_success $PREREQ 'setup fake get_maintainer.pl script for cc 
> trailer' "
> - cat >expected-cc-script.sh <<-EOF &&
> - #!/bin/sh
> + write_script expected-cc-script.sh <<-EOF &&
>   echo 'One Person  (supporter:THIS (FOO/bar))'
>   echo 'Two Person  (maintainer:THIS THING)'
>   echo 'Third List  (moderated list:THIS THING 
> (FOO/bar))'

Please do not forget to lose "chmod +x", which becomes unneeded when
you use write_script.

> @@ -186,7 +185,6 @@ test_expect_success $PREREQ 'setup fake get_maintainer.pl 
> script for cc trailer'
>  "
>  
>  test_expect_success $PREREQ 'cc trailer with get_maintainer.pl output' '
> - test_commit cc-trailer-getmaint &&
>   clean_fake_sendmail &&
>   git send-email -1 --to=recipi...@example.com \
>   --cc-cmd="./expected-cc-script.sh" \


Re: [PATCH] send-email: add test for Linux's get_maintainer.pl

2018-01-05 Thread Matthieu Moy
Alex Bennée  writes:

> I think you need to apply Eric's suggestions from:
>
>   From: Eric Sunshine 
>   Date: Sat, 18 Nov 2017 21:54:46 -0500
>   Message-ID: 
> 

Indeed. I'm squashing this into the patch:

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index f126177..d13d8c3 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -173,8 +173,7 @@ test_expect_success $PREREQ 'cc trailer with various 
syntax' '
 '
 
 test_expect_success $PREREQ 'setup fake get_maintainer.pl script for cc 
trailer' "
-   cat >expected-cc-script.sh <<-EOF &&
-   #!/bin/sh
+   write_script expected-cc-script.sh <<-EOF &&
echo 'One Person  (supporter:THIS (FOO/bar))'
echo 'Two Person  (maintainer:THIS THING)'
echo 'Third List  (moderated list:THIS THING 
(FOO/bar))'
@@ -186,7 +185,6 @@ test_expect_success $PREREQ 'setup fake get_maintainer.pl 
script for cc trailer'
 "
 
 test_expect_success $PREREQ 'cc trailer with get_maintainer.pl output' '
-   test_commit cc-trailer-getmaint &&
clean_fake_sendmail &&
git send-email -1 --to=recipi...@example.com \
--cc-cmd="./expected-cc-script.sh" \


-- 
Matthieu Moy
https://matthieu-moy.fr/


Re: [PATCH] send-email: add test for Linux's get_maintainer.pl

2018-01-05 Thread Alex Bennée

Matthieu Moy  writes:

> From: Alex Bennée 
>
> We had a regression that broke Linux's get_maintainer.pl. Using
> Mail::Address to parse email addresses fixed it, but let's protect
> against future regressions.
>
> Patch-edited-by: Matthieu Moy 
> Signed-off-by: Alex Bennée 
> Signed-off-by: Matthieu Moy 
> ---
>  t/t9001-send-email.sh | 22 ++
>  1 file changed, 22 insertions(+)
>
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index 4d261c2..f126177 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -172,6 +172,28 @@ test_expect_success $PREREQ 'cc trailer with various 
> syntax' '
>   test_cmp expected-cc commandline1
>  '
>
> +test_expect_success $PREREQ 'setup fake get_maintainer.pl script for cc 
> trailer' "
> + cat >expected-cc-script.sh <<-EOF &&
> + #!/bin/sh
> + echo 'One Person  (supporter:THIS (FOO/bar))'
> + echo 'Two Person  (maintainer:THIS THING)'
> + echo 'Third List  (moderated list:THIS THING 
> (FOO/bar))'
> + echo ' (moderated list:FOR THING)'
> + echo 'f...@example.com (open list:FOR THING (FOO/bar))'
> + echo 's...@example.com (open list)'
> + EOF
> + chmod +x expected-cc-script.sh
> +"
> +
> +test_expect_success $PREREQ 'cc trailer with get_maintainer.pl output' '
> + test_commit cc-trailer-getmaint &&
> + clean_fake_sendmail &&
> + git send-email -1 --to=recipi...@example.com \
> + --cc-cmd="./expected-cc-script.sh" \
> + --smtp-server="$(pwd)/fake.sendmail" &&
> + test_cmp expected-cc commandline1
> +'
> +
>  test_expect_success $PREREQ 'setup expect' "
>  cat >expected-show-all-headers <<\EOF
>  0001-Second.patch

I think you need to apply Eric's suggestions from:

  From: Eric Sunshine 
  Date: Sat, 18 Nov 2017 21:54:46 -0500
  Message-ID: 


--
Alex Bennée


[PATCH] send-email: add test for Linux's get_maintainer.pl

2018-01-05 Thread Matthieu Moy
From: Alex Bennée 

We had a regression that broke Linux's get_maintainer.pl. Using
Mail::Address to parse email addresses fixed it, but let's protect
against future regressions.

Patch-edited-by: Matthieu Moy 
Signed-off-by: Alex Bennée 
Signed-off-by: Matthieu Moy 
---
 t/t9001-send-email.sh | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 4d261c2..f126177 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -172,6 +172,28 @@ test_expect_success $PREREQ 'cc trailer with various 
syntax' '
test_cmp expected-cc commandline1
 '
 
+test_expect_success $PREREQ 'setup fake get_maintainer.pl script for cc 
trailer' "
+   cat >expected-cc-script.sh <<-EOF &&
+   #!/bin/sh
+   echo 'One Person  (supporter:THIS (FOO/bar))'
+   echo 'Two Person  (maintainer:THIS THING)'
+   echo 'Third List  (moderated list:THIS THING 
(FOO/bar))'
+   echo ' (moderated list:FOR THING)'
+   echo 'f...@example.com (open list:FOR THING (FOO/bar))'
+   echo 's...@example.com (open list)'
+   EOF
+   chmod +x expected-cc-script.sh
+"
+
+test_expect_success $PREREQ 'cc trailer with get_maintainer.pl output' '
+   test_commit cc-trailer-getmaint &&
+   clean_fake_sendmail &&
+   git send-email -1 --to=recipi...@example.com \
+   --cc-cmd="./expected-cc-script.sh" \
+   --smtp-server="$(pwd)/fake.sendmail" &&
+   test_cmp expected-cc commandline1
+'
+
 test_expect_success $PREREQ 'setup expect' "
 cat >expected-show-all-headers <<\EOF
 0001-Second.patch
-- 
2.7.4