-# Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use strict;
use warnings;
use Test::More;
+use PublicInbox::TestCommon;
+require_mods 'Email::Simple';
use_ok('PublicInbox::SearchThread');
-use Email::Simple;
my $mt = eval {
require Mail::Thread;
no warnings 'once';
my $msg = $_;
$msg->{ds} ||= ++$n;
$msg->{references} =~ s/\s+/ /sg if $msg->{references};
+ $msg->{blob} = '0'x40; # any dummy value will do, here
my $simple = Email::Simple->create(header => [
'Message-ID' => "<$msg->{mid}>",
'References' => $msg->{references},
sub thread_to_s {
my ($msgs) = @_;
my $rootset = PublicInbox::SearchThread::thread($msgs, sub {
- [ sort { $a->{id} cmp $b->{id} } @{$_[0]} ] });
+ [ sort { $a->{mid} cmp $b->{mid} } @{$_[0]} ] });
my $st = '';
my @q = map { (0, $_) } @$rootset;
while (@q) {
my $level = shift @q;
my $node = shift @q or next;
- $st .= (" "x$level). "$node->{id}\n";
+ $st .= (" "x$level). "$node->{mid}\n";
my $cl = $level + 1;
unshift @q, map { ($cl, $_) } @{$node->{children}};
}