about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-03-20 08:18:18 +0000
committerEric Wong <e@yhbt.net>2020-03-22 09:00:23 +0000
commit1218a4126807951a0f47286338dc04d7f197bb78 (patch)
tree5f97519d19a5fdfb92feecd8e64db43c036432d5 /t
parentd34a4b80724e3f77a507ad08b91039427b0e09d5 (diff)
downloadpublic-inbox-1218a4126807951a0f47286338dc04d7f197bb78.tar.gz
We can pass blessed PublicInbox::Smsg objects to internal
indexing APIs instead of having long parameter lists in some
places.  The end goal is to avoid parsing redundant information
each step of the way and hopefully make things more
understandable.
Diffstat (limited to 't')
-rw-r--r--t/search-thr-index.t17
1 files changed, 15 insertions, 2 deletions
diff --git a/t/search-thr-index.t b/t/search-thr-index.t
index 6a5fd919..f073304a 100644
--- a/t/search-thr-index.t
+++ b/t/search-thr-index.t
@@ -9,6 +9,7 @@ use PublicInbox::MID qw(mids);
 use Email::MIME;
 require_mods(qw(DBD::SQLite Search::Xapian));
 require PublicInbox::SearchIdx;
+require PublicInbox::Smsg;
 require PublicInbox::Inbox;
 my ($tmpdir, $for_destroy) = tmpdir();
 my $git_dir = "$tmpdir/a.git";
@@ -45,7 +46,13 @@ foreach (reverse split(/\n\n/, $data)) {
         $mime->header_set('To' => 'git@vger.kernel.org');
         my $bytes = bytes::length($mime->as_string);
         my $mid = mids($mime->header_obj)->[0];
-        my $doc_id = $rw->add_message($mime, $bytes, ++$num, 'ignored', $mid);
+        my $smsg = bless {
+                bytes => $bytes,
+                num => ++$num,
+                mid => $mid,
+                blob => '',
+        }, 'PublicInbox::Smsg';
+        my $doc_id = $rw->add_message($mime, $smsg);
         push @mids, $mid;
         ok($doc_id, 'message added: '. $mid);
 }
@@ -86,7 +93,13 @@ SELECT tid FROM over WHERE num = ? LIMIT 1
 
         my $bytes = bytes::length($mime->as_string);
         my $mid = mids($mime->header_obj)->[0];
-        my $doc_id = $rw->add_message($mime, $bytes, $num, 'ignored', $mid);
+        my $smsg = bless {
+                bytes => $bytes,
+                num => $num,
+                mid => $mid,
+                blob => '',
+        }, 'PublicInbox::Smsg';
+        my $doc_id = $rw->add_message($mime, $smsg);
         ok($doc_id, 'message reindexed'. $mid);
         is($doc_id, $num, "article number unchanged: $num");