From c8f9d13dc6ddcb6c9e22584324c18b7d74e772ea Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Mon, 8 Jan 2018 11:34:33 +0100 Subject: perl/Git: remove now useless email-address parsing code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We now use Mail::Address unconditionaly, hence parse_mailboxes is now dead code. Remove it and its tests. Signed-off-by: Matthieu Moy Reviewed-by: Alex Bennée Signed-off-by: Junio C Hamano --- t/t9000-addresses.sh | 27 --------------------- t/t9000/test.pl | 67 ---------------------------------------------------- 2 files changed, 94 deletions(-) delete mode 100755 t/t9000-addresses.sh delete mode 100755 t/t9000/test.pl (limited to 't') diff --git a/t/t9000-addresses.sh b/t/t9000-addresses.sh deleted file mode 100755 index a1ebef6de2..0000000000 --- a/t/t9000-addresses.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -test_description='compare address parsing with and without Mail::Address' -. ./test-lib.sh - -if ! test_have_prereq PERL; then - skip_all='skipping perl interface tests, perl not available' - test_done -fi - -perl -MTest::More -e 0 2>/dev/null || { - skip_all="Perl Test::More unavailable, skipping test" - test_done -} - -perl -MMail::Address -e 0 2>/dev/null || { - skip_all="Perl Mail::Address unavailable, skipping test" - test_done -} - -test_external_has_tap=1 - -test_external_without_stderr \ - 'Perl address parsing function' \ - perl "$TEST_DIRECTORY"/t9000/test.pl - -test_done diff --git a/t/t9000/test.pl b/t/t9000/test.pl deleted file mode 100755 index dfeaa9c655..0000000000 --- a/t/t9000/test.pl +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/perl -use lib (split(/:/, $ENV{GITPERLLIB})); - -use 5.008; -use warnings; -use strict; - -use Test::More qw(no_plan); -use Mail::Address; - -BEGIN { use_ok('Git') } - -my @success_list = (q[Jane], - q[jdoe@example.com], - q[], - q[Jane ], - q[Jane Doe ], - q["Jane" ], - q["Doe, Jane" ], - q["Jane@:;\>.,()], - q[Jane!#$%&'*+-/=?^_{|}~Doe' ], - q[""], - q["Jane jdoe@example.com"], - q[Jane Doe ], - q[Jane Doe < jdoe@example.com >], - q[Jane @ Doe @ Jane @ Doe], - q["Jane, 'Doe'" ], - q['Doe, "Jane' ], - q["Jane" "Do"e ], - q["Jane' Doe" ], - q["Jane Doe " ], - q["Jane\" Doe" ], - q[Doe, jane ], - q["Jane Doe ], - q['Jane 'Doe' ], - q[Jane@:;\.,()<>Doe ], - q[Jane Doe], - q[ Jane Doe]); - -my @known_failure_list = (q[Jane\ Doe ], - q["Doe, Ja"ne ], - q["Doe, Katarina" Jane ], - q[Jane jdoe@example.com], - q["Jane "Kat"a" ri"na" ",Doe" ], - q[Jane Doe], - q[Jane "Doe "], - q[\"Jane Doe ], - q[Jane\"\" Doe ], - q['Jane "Katarina\" \' Doe' ]); - -foreach my $str (@success_list) { - my @expected = map { $_->format } Mail::Address->parse("$str"); - my @actual = Git::parse_mailboxes("$str"); - is_deeply(\@expected, \@actual, qq[same output : $str]); -} - -TODO: { - local $TODO = "known breakage"; - foreach my $str (@known_failure_list) { - my @expected = map { $_->format } Mail::Address->parse("$str"); - my @actual = Git::parse_mailboxes("$str"); - is_deeply(\@expected, \@actual, qq[same output : $str]); - } -} - -my $is_passing = eval { Test::More->is_passing }; -exit($is_passing ? 0 : 1) unless $@ =~ /Can't locate object method/; -- cgit v1.2.3 From d60be8acab06c34886338cbf98f7628284705979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Mon, 8 Jan 2018 11:34:34 +0100 Subject: send-email: add test for Linux's get_maintainer.pl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Note that we need --cc-cmd to be relative because this option doesn't accept spaces in script names (probably to allow --cc-cmd="executable --option"), while --smtp-server needs to be absolute. Patch-edited-by: Matthieu Moy Signed-off-by: Alex Bennée Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't') diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 4d261c2a9c..a06e5d7ba5 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -172,6 +172,25 @@ 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' " + 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))' + echo ' (moderated list:FOR THING)' + echo 'five@example.com (open list:FOR THING (FOO/bar))' + echo 'six@example.com (open list)' + EOF +" + +test_expect_success $PREREQ 'cc trailer with get_maintainer.pl output' ' + clean_fake_sendmail && + git send-email -1 --to=recipient@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 -- cgit v1.2.3