-my $mime = PublicInbox::MIME->create(
- header => [
- From => 'a@example.com',
- To => 'b@example.com',
- 'Content-Type' => 'text/plain',
- Subject => 'this is a subject',
- 'Message-ID' => '<a@example.com>',
- Date => 'Fri, 02 Oct 1993 00:00:00 +0000',
- ],
- body => "hello world\n",
-);
-
-$im->{want_object_id} = 1 if 'v2';
-like($im->add($mime), qr/\A:\d+\z/, 'added one message');
-
-if ('v2') {
- like($im->{last_object_id}, qr/\A[a-f0-9]{40}\z/, 'got last_object_id');
+$im->init_bare;
+my $mime = PublicInbox::Eml->new(<<'EOF');
+From: a@example.com
+To: b@example.com
+Subject: this is a subject
+Message-ID: <a@example.com>
+Date: Fri, 02 Oct 1993 00:00:00 +0000
+
+hello world
+EOF
+
+my $v2 = require_git(2.6, 1);
+my $smsg = bless {}, 'PublicInbox::Smsg' if $v2;
+like($im->add($mime, undef, $smsg), qr/\A:[0-9]+\z/, 'added one message');
+
+if ($v2) {
+ like($smsg->{blob}, qr/\A[a-f0-9]{40}\z/, 'got last object_id');
+ my $raw_email = $smsg->{-raw_email};
+ is($mime->as_string, $$raw_email, 'string matches');
+ is($smsg->{raw_bytes}, length($$raw_email), 'length matches');