X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=t%2Fview.t;h=b829ecf883f8cca07cf28444e5ba4741578de57c;hp=8ae422569a91e2efa054742ea6c1dbcf3e04aec2;hb=0f28e69ed76f6d0c14b0458019224c10590474df;hpb=4dfef4f8f26bc8615c695969bd99157c9f3d2f2a diff --git a/t/view.t b/t/view.t index 8ae42256..b829ecf8 100644 --- a/t/view.t +++ b/t/view.t @@ -170,4 +170,25 @@ EOF 'regular ID not compressed'); } +{ + my $cols = PublicInbox::View::COLS(); + my @addr; + until (length(join(', ', @addr)) > ($cols * 2)) { + push @addr, '"l, f" '; + my $n = int(rand(20)) + 1; + push @addr, ('x'x$n).'@x'; + } + my $orig = join(', ', @addr); + my $res = PublicInbox::View::fold_addresses($orig.''); + isnt($res, $orig, 'folded result'); + unlike($res, qr/l,\n\tf/s, '"last, first" no broken'); + my @nospc = ($res, $orig); + s/\s+//g for @nospc; + is($nospc[0], $nospc[1], 'no addresses lost in translation'); + my $tws = PublicInbox::View::fold_addresses($orig.' '); + # (Email::Simple drops leading whitespace, but not trailing) + $tws =~ s/ \z//; + is($tws, $res, 'not thrown off by trailing whitespace'); +} + done_testing();