]> git.donarmstrong.com Git - debbugs.git/blobdiff - t/13_utf8_mail.t
make the submitter be in utf8 to catch more problems
[debbugs.git] / t / 13_utf8_mail.t
index 588598432277c93666fef90aa9cda54043e0263b..d5397dc9a5e492d5c77e12d37c86cff05d43b508 100644 (file)
@@ -6,6 +6,8 @@ use Test::More tests => 12;
 use warnings;
 use strict;
 
+use utf8;
+
 # Here, we're going to shoot messages through a set of things that can
 # happen.
 
@@ -22,7 +24,7 @@ use File::Basename qw(dirname basename);
 use lib qw(t/lib);
 use DebbugsTest qw(:all);
 use Data::Dumper;
-use Encode qw(decode encode);
+use Encode qw(decode encode decode_utf8);
 
 # HTTP::Server:::Simple defines a SIG{CHLD} handler that breaks system; undef it here.
 $SIG{CHLD} = sub {};
@@ -51,7 +53,7 @@ END{
 
 send_message(to=>'submit@bugs.something',
             headers => [To   => 'submit@bugs.something',
-                        From => 'foo@bugs.something',
+                        From => 'foöff@bugs.something',
                         Subject => 'Submiting a bug',
                        ],
             body => <<EOF,attachments => [{Type=>"text/plain",Charset=>"utf-8",Data=><<EOF2}]) or fail('Unable to send message');
@@ -89,7 +91,7 @@ $SD_SIZE =
 
 send_message(to => '1@bugs.something',
             headers => [To   => '1@bugs.something',
-                        From => 'foo@bugs.something',
+                        From => 'föoff@bugs.something',
                         Subject => 'Sending a message to a bug',
                        ],
             body => <<EOF) or fail('sending message to 1@bugs.someting failed');
@@ -107,7 +109,7 @@ $SD_SIZE =
 # just check to see that control doesn't explode
 send_message(to => 'control@bugs.something',
             headers => [To   => 'control@bugs.something',
-                        From => 'foo@bugs.something',
+                        From => 'föoff@bugs.something',
                         Subject => 'Munging a bug',
                        ],
             body => <<EOF) or fail 'message to control@bugs.something failed';
@@ -129,6 +131,6 @@ eval "use Debbugs::Status qw(read_bug writebug);";
 my $status = read_bug(bug=>1);
 ok($status->{subject} eq 'ütff8 title encoding test','bug 1 retitled');
 ok($status->{severity} eq 'wishlist','bug 1 wishlisted');
-ok(system('sh','-c','[ $(grep "encoding test" '.$spool_dir.'/db-h/01/1.log|grep -v "ütff8"|wc -l) -eq 0 ]') == 0,
+ok(system('sh','-c','[ $(egrep "retitle.*encoding test" '.$spool_dir.'/db-h/01/1.log|grep -v "=C3=BCt=EF=AC=808"|wc -l) -eq 0 ]') == 0,
    'Control messages escaped properly');