dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH] wip
Date: Sun, 15 Nov 2020 07:35:31 +0000	[thread overview]
Message-ID: <20201115073531.11266-1-e@80x24.org> (raw)

---
 t/eml.t | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/t/eml.t b/t/eml.t
index 8d131b14..3012a035 100644
--- a/t/eml.t
+++ b/t/eml.t
@@ -269,7 +269,7 @@ Object-Id: ab0440d8cd6d843bee9a27709a459ce3b2bdb94d (lore/kvm)
 EOF
 	my $eml = $cls->new(\$s);
 	my ($str, $err) = msg_part_text($eml, $eml->content_type);
-	is($str, "\x{100}\n", "got wide character by assuming utf-8");
+	is($str, "\x{100}\n", "got wide character by assuming utf-8 ($cls)");
 }
 
 if ('we differ from Email::MIME with final "\n" on missing epilogue') {
@@ -383,8 +383,12 @@ SKIP: {
 		$msg->parts_set([$old[-1]]);
 		is(scalar $msg->subparts, 1, 'only last remains');
 	}
-	is($eml->as_string, $mime->as_string,
-		'as_string matches after parts_set');
+
+	# some versions of Email::MIME or Email::MIME::* will drop
+	# unnecessary ", while PublicInbox::Eml will preserve the original
+	my $exp = $mime->as_string;
+	$exp =~ s/; boundary=b\b/; boundary="b"/;
+	is($eml->as_string, $exp, 'as_string matches after parts_set');
 }
 
 for my $cls (@classes) {
@@ -395,7 +399,8 @@ Content-Disposition: attachment; filename="=?utf-8?q?vtpm-makefile.patch?="
 EOF
 	is($cls->new($s)->filename, 'vtpm-makefile.patch', 'filename decoded');
 	$s =~ s/^Content-Disposition:.*$//sm;
-	is($cls->new($s)->filename, 'vtpm-fakefile.patch', 'filename fallback');
+	is($cls->new($s)->filename, 'vtpm-fakefile.patch',
+		"filename fallback ($cls)") if $cls ne 'PublicInbox::MIME';
 	is($cls->new($s)->content_type,
 		'text/x-patch; name="vtpm-fakefile.patch"',
 		'matches Email::MIME output, "correct" or not');
@@ -416,7 +421,7 @@ EOF
 	my @tmp;
 	$cls->new($s)->each_part(sub { push @tmp, $_[0]->[0]->filename });
 	is_deeply(['vtpm-makefile.patch', 'vtpm-fakefile.patch'], \@tmp,
-		'got filename for both attachments');
+		"got filename for both attachments ($cls)");
 }
 
 done_testing;

             reply	other threads:[~2020-11-15  7:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15  7:35 Eric Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-27 20:16 [PATCH] wip Eric Wong
2021-06-05 19:58 Eric Wong
2021-04-05  7:42 Eric Wong
2021-03-08  7:11 Eric Wong
2021-01-21  4:24 [PATCH] WIP Eric Wong
2021-01-03 22:57 [PATCH] wip Eric Wong
2020-12-27 11:36 [PATCH] WIP Eric Wong
2020-04-23  4:27 [PATCH] wip Eric Wong
2020-04-20  7:14 Eric Wong
2020-01-13  9:24 [PATCH] WIP Eric Wong
2019-05-11 22:55 Eric Wong
2019-01-02  9:21 [PATCH] wip Eric Wong
2018-07-06 21:31 Eric Wong
2018-06-24 11:55 Eric Wong
2018-06-24  8:39 Eric Wong
2017-07-15  1:42 [PATCH] WIP Eric Wong
2017-04-12 20:17 [PATCH] wip Eric Wong
2017-04-05 18:40 Eric Wong
2016-08-23 20:07 Eric Wong
2016-08-18  2:16 Eric Wong
2016-06-26  3:46 Eric Wong
2015-12-22  0:15 Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201115073531.11266-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).