diff options
author | Eric Wong <e@80x24.org> | 2018-04-23 04:16:53 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-04-23 04:17:09 +0000 |
commit | 0f28e69ed76f6d0c14b0458019224c10590474df (patch) | |
tree | db721affa23bdc5a25fa3cfb854f5e9cfdcaaca5 /t | |
parent | 4dfef4f8f26bc8615c695969bd99157c9f3d2f2a (diff) | |
download | public-inbox-0f28e69ed76f6d0c14b0458019224c10590474df.tar.gz |
It is common to have large amounts of addresses Cc:-ed in large mailing lists like LKML. Make them more readable by wrapping after addresses. Unfortunately, line breaks inserted by the MUA get lost when using the public Email::MIME API. Subject and body lines remain unwrapped, as it's the author's fault to have such long lines :P
Diffstat (limited to 't')
-rw-r--r-- | t/view.t | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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" <a@a>'; + 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(); |