about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-03 02:06:15 +0000
committerEric Wong <e@80x24.org>2021-01-03 18:30:31 +0000
commit71461c67fee940b05309baa8c67bac10c8c51ac6 (patch)
tree07ab30ed55e4bd62ab2022167e14e0ae09bb43ad /t
parent323d8bac125e89a76c904a54a7ae0b2e36f05cc6 (diff)
downloadpublic-inbox-71461c67fee940b05309baa8c67bac10c8c51ac6.tar.gz
We don't need to be keeping the raw message around after it hits
git.  Shard work now relies on Storable (or Sereal) and all of
the indexing code relies on the Email::MIME-like API of Eml to
access interesting parts of the message.

Similarly, smsg->{raw_bytes} is no longer carried around and we
do the CRLF adjustment when setting smsg->{bytes}.

There's also a small simplification to t/import.t while
we're in the area to use xqx instead of spawn/popen_rd.
Diffstat (limited to 't')
-rw-r--r--t/import.t12
-rw-r--r--t/search.t2
2 files changed, 3 insertions, 11 deletions
diff --git a/t/import.t b/t/import.t
index 855b5d7c..ae76858b 100644
--- a/t/import.t
+++ b/t/import.t
@@ -7,7 +7,6 @@ use PublicInbox::Eml;
 use PublicInbox::Smsg;
 use PublicInbox::Git;
 use PublicInbox::Import;
-use PublicInbox::Spawn qw(spawn);
 use Fcntl qw(:DEFAULT SEEK_SET);
 use PublicInbox::TestCommon;
 use MIME::Base64 3.05; # Perl 5.10.0 / 5.9.2
@@ -32,20 +31,13 @@ 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');
         my @cmd = ('git', "--git-dir=$git->{git_dir}", qw(hash-object --stdin));
         open my $in, '+<', undef or BAIL_OUT "open(+<): $!";
         print $in $mime->as_string or die "write failed: $!";
         $in->flush or die "flush failed: $!";
-        seek($in, 0, SEEK_SET);
-        open my $out, '+<', undef or BAIL_OUT "open(+<): $!";
-        my $pid = spawn(\@cmd, {}, { 0 => $in, 1 => $out });
-        is(waitpid($pid, 0), $pid, 'waitpid succeeds on hash-object');
+        seek($in, 0, SEEK_SET) or die "seek: $!";
+        chomp(my $hashed_obj = xqx(\@cmd, undef, { 0 => $in }));
         is($?, 0, 'hash-object');
-        seek($out, 0, SEEK_SET);
-        chomp(my $hashed_obj = <$out>);
         is($hashed_obj, $smsg->{blob}, "blob object_id matches exp");
 }
 
diff --git a/t/search.t b/t/search.t
index 7495233e..b2958c00 100644
--- a/t/search.t
+++ b/t/search.t
@@ -60,7 +60,7 @@ sub oct_is ($$$) {
 }
 
 {
-        my $crlf_adjust = \&PublicInbox::SearchIdx::crlf_adjust;
+        my $crlf_adjust = \&PublicInbox::Smsg::crlf_adjust;
         is($crlf_adjust->("hi\r\nworld\r\n"), 0, 'no adjustment needed');
         is($crlf_adjust->("hi\nworld\n"), 2, 'LF-only counts two CR');
         is($crlf_adjust->("hi\r\nworld\n"), 1, 'CRLF/LF-mix 1 counts 1 CR');