X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Freply.t;h=41d72db22c6586eb771009c056b413123ddae77c;hb=21fcd8a37c82c1ef654d402cf592f0c9d803aa26;hp=de31f8800be717ddb2bee17a7db3063a6253676e;hpb=3d41aa23f35501ca92aab8aa42980fa73f7fa74f;p=public-inbox.git diff --git a/t/reply.t b/t/reply.t index de31f880..41d72db2 100644 --- a/t/reply.t +++ b/t/reply.t @@ -1,9 +1,10 @@ -# Copyright (C) 2017-2018 all contributors +#!perl -w +# Copyright (C) 2017-2021 all contributors # License: AGPL-3+ use strict; -use warnings; use Test::More; -use Email::MIME; +use PublicInbox::Config; +use PublicInbox::Eml; use_ok 'PublicInbox::Reply'; my @q = ( @@ -15,11 +16,11 @@ my @q = ( while (@q) { my $input = shift @q; my $expect = shift @q; - my $res = PublicInbox::Reply::squote_maybe($input); + my $res = PublicInbox::Config::squote_maybe($input); is($res, $expect, "quote $input => $res"); } -my $mime = Email::MIME->new(<<'EOF'); +my $mime = PublicInbox::Eml->new(<<'EOF'); From: from To: to Cc: cc@example.com @@ -36,7 +37,8 @@ my $exp = [ '--in-reply-to=blah@example.com', '--to=from@example.com', '--cc=cc@example.com', - '--cc=to@example.com' + '--cc=to@example.com', + "--subject='Re: hihi'" ]; is_deeply($arg, $exp, 'default reply is to :all'); @@ -44,7 +46,8 @@ $ibx->{replyto} = ':all'; ($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr); is_deeply($arg, $exp, '":all" also works'); -$exp = [ '--in-reply-to=blah@example.com', '--to=primary@example.com' ]; +$exp = [ '--in-reply-to=blah@example.com', '--to=primary@example.com', + "--subject='Re: hihi'" ]; $ibx->{replyto} = ':list'; ($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr); is_deeply($arg, $exp, '":list" works for centralized lists'); @@ -53,7 +56,8 @@ $exp = [ '--in-reply-to=blah@example.com', '--to=primary@example.com', '--cc=cc@example.com', - '--cc=to@example.com' + '--cc=to@example.com', + "--subject='Re: hihi'" ]; $ibx->{replyto} = ':list,Cc,To'; ($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr); @@ -61,7 +65,9 @@ is_deeply($arg, $exp, '":list,Cc,To" works for kinda centralized lists'); $ibx->{replyto} = 'new@example.com'; ($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr); -$exp = [ '--in-reply-to=blah@example.com', '--to=new@example.com' ]; +$exp = [ '--in-reply-to=blah@example.com', '--to=new@example.com', + "--subject='Re: hihi'" +]; is_deeply($arg, $exp, 'explicit address works, too'); $ibx->{replyto} = ':all'; @@ -71,9 +77,15 @@ $exp = [ '--in-reply-to=blah@example.com', '--to=from@example$(echo .)com', '--cc=cc@example$(echo .)com', - '--cc=to@example$(echo .)com' + '--cc=to@example$(echo .)com', + "--subject='Re: hihi'" ]; is_deeply($arg, $exp, 'address obfuscation works'); is($link, '', 'no mailto: link given'); +$ibx->{replyto} = ':none=dead list'; +$ibx->{obfuscate} = 1; +($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr); +is($$arg, 'dead list', ':none= works'); + done_testing();