Skip to content

Commit

Permalink
Fix remaining subject encoding test failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Mar 29, 2016
1 parent 95d0cda commit 6c83099
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Revision history for Perl extension SVN::Notify
- Fixed a typo, thanks to gregor herrmann of the Debian project.
- Eliminated "Unescaped left brace in regex is deprecated" warnings on
Perl 5.21.
- Fixed test failures triggered by an improvement to the encoding of
headers by the Encode module. Thanks to Pali for the fix!

2.84 2013-08-13T14:25:21Z
- Added `--smtp-tls` to the output of `man svnnotify`.
Expand Down
4 changes: 2 additions & 2 deletions t/base.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ my $subj = "Did this, that, and the «other».";
my $qsubj;
if (SVN::Notify::PERL58()) {
$subj = Encode::decode_utf8( $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', '[111] ' . $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', "[111] $subj" );
} else {
$qsubj = quotemeta $subj;
$qsubj = quotemeta "[111] $subj";
}

##############################################################################
Expand Down
6 changes: 3 additions & 3 deletions t/filter.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ my $subj = "DId thIs, thAt, And thE «OthEr».";
my $qsubj;
if (SVN::Notify::PERL58()) {
Encode::_utf8_on( $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', "[111] $subj" );
} else {
$qsubj = quotemeta $subj;
$qsubj = quotemeta "[111] $subj";
}

##############################################################################
Expand Down Expand Up @@ -81,7 +81,7 @@ ok $notifier->prepare, 'Prepare recipients filter checking';
ok $notifier->execute, 'Notify recipients_mesage filter checking';
like $email, qr/^To: tEst[@]ExAmplE[.]cOm/m, 'The recipient should be modified';
like $email, qr/From: thEOry/m, 'The From header should be modified';
like $email, qr/Subject: \[111\] $qsubj/m, 'The Subject should be modified';
like $email, qr/Subject: $qsubj/m, 'The Subject should be modified';

##############################################################################
# Metadata filter.
Expand Down
12 changes: 6 additions & 6 deletions t/html.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ my $subj = "Did this, that, and the «other».";
my $qsubj;
if (SVN::Notify::PERL58()) {
Encode::_utf8_on( $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', "[111] $subj" );
} else {
$qsubj = quotemeta $subj;
$qsubj = quotemeta "[111] $subj";
}

##############################################################################
Expand All @@ -59,7 +59,7 @@ ok( $notifier->execute, "HTML notify" );
my $email = get_output();

# Check the email headers.
like( $email, qr/Subject: \[111\] $qsubj\n/, 'Check HTML subject' );
like( $email, qr/Subject: $qsubj\n/, 'Check HTML subject' );
like( $email, qr/From: theory\n/, 'Check HTML From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML To');
like( $email, qr{Content-Type: text/html; charset=UTF-8\n},
Expand Down Expand Up @@ -133,7 +133,7 @@ ok( $notifier->execute, "HTML notify" );
$email = get_output();

# Check the email headers.
like( $email, qr/Subject: \[111\] $qsubj\n/, 'Check HTML subject' );
like( $email, qr/Subject: $qsubj\n/, 'Check HTML subject' );
like( $email, qr/From: theory\n/, 'Check HTML From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML To');
like( $email, qr{Content-Type: text/html; charset=UTF-8\n},
Expand All @@ -159,7 +159,7 @@ NO_BADLANG: {
# Get the output.
$email = get_output();

like( $email, qr/Subject: \[111\] $qsubj\n/, 'Check HTML subject' );
like( $email, qr/Subject: $qsubj\n/, 'Check HTML subject' );
like( $email, qr/From: theory\n/, 'Check HTML diff From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML diff To');

Expand Down Expand Up @@ -214,7 +214,7 @@ ok( $notifier->execute, "Attach HTML attach diff notify" );
# Get the output.
$email = get_output();

like( $email, qr/Subject: \[111\] $qsubj\n/,
like( $email, qr/Subject: $qsubj\n/,
"Check HTML attach diff subject" );
like( $email, qr/From: theory\n/, 'Check HTML attach diff From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML attach diff To');
Expand Down
12 changes: 6 additions & 6 deletions t/htmlcolordiff.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ my $subj = "Did this, that, and the «other».";
my $qsubj;
if (SVN::Notify::PERL58()) {
Encode::_utf8_on( $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', "[111] $subj" );
} else {
$qsubj = quotemeta $subj;
$qsubj = quotemeta "[111] $subj";
}

##############################################################################
Expand All @@ -49,7 +49,7 @@ ok( $notifier->execute, "HTML notify" );
my $email = get_output();

# Check the email headers.
like( $email, qr/Subject: \[111\] $qsubj\n/, 'Check HTML subject' );
like( $email, qr/Subject: $qsubj\n/, 'Check HTML subject' );
like( $email, qr/From: theory\n/, 'Check HTML From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML To');
like( $email, qr{Content-Type: text/html; charset=UTF-8\n},
Expand Down Expand Up @@ -119,7 +119,7 @@ ok( $notifier->execute, "HTML notify" );
$email = get_output();

# Check the email headers.
like( $email, qr/Subject: \[111\] $qsubj\n/, 'Check HTML subject' );
like( $email, qr/Subject: $qsubj\n/, 'Check HTML subject' );
like( $email, qr/From: theory\n/, 'Check HTML From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML To');
like( $email, qr{Content-Type: text/html; charset=UTF-8\n},
Expand All @@ -140,7 +140,7 @@ ok( $notifier->execute, "HTML diff notify" );
# Get the output.
$email = get_output();

like( $email, qr/Subject: \[111\] $qsubj\n/, 'Check HTML diff subject' );
like( $email, qr/Subject: $qsubj\n/, 'Check HTML diff subject' );
like( $email, qr/From: theory\n/, 'Check HTML diff From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML diff To');

Expand Down Expand Up @@ -219,7 +219,7 @@ ok( $notifier->execute, "Attach HTML attach diff notify" );
# Get the output.
$email = get_output();

like( $email, qr/Subject: \[111\] $qsubj\n/, 'Check HTML attach diff subject' );
like( $email, qr/Subject: $qsubj\n/, 'Check HTML attach diff subject' );
like( $email, qr/From: theory\n/, 'Check HTML attach diff From');
like( $email, qr/To: test\@example\.com\n/, 'Check HTML attach diff To');

Expand Down
6 changes: 3 additions & 3 deletions t/smtp.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ my $subj = "Did this, that, and the «other».";
my $qsubj;
if (SVN::Notify::PERL58()) {
Encode::_utf8_on( $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', $subj );
$qsubj = quotemeta Encode::encode( 'MIME-Q', "[111] $subj" );
} else {
$qsubj = quotemeta $subj;
$qsubj = quotemeta "[111] $subj";
}

##############################################################################
Expand All @@ -52,7 +52,7 @@ ok $smtp->{data}, 'data() should have been called';
ok $smtp->{dataend}, 'dataend() should have been called';
ok $smtp->{quit}, 'quit() should have been called';

like $smtp->{datasend}, qr/Subject: \[111\] $qsubj\n/, 'Check subject';
like $smtp->{datasend}, qr/Subject: $qsubj\n/, 'Check subject';
like $smtp->{datasend}, qr/From: theory\n/, 'Check From';
like $smtp->{datasend}, qr/To:\s+test\@example\.com,\s+try\@example\.com\n/,
'Check To';
Expand Down

0 comments on commit 6c83099

Please sign in to comment.