X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fthread-cycle.t;h=484ea443c9b1fabc30d2c2bbfb164aa026e2c0e3;hb=0283273a14e1871955f6a9132f4f3f7884ec8a3f;hp=78dcb6f9db14892495b661e93b0670accb7c44f9;hpb=c204da04aa24e85236f82ba5a7c6c7e19c8a20d3;p=public-inbox.git diff --git a/t/thread-cycle.t b/t/thread-cycle.t index 78dcb6f9..484ea443 100644 --- a/t/thread-cycle.t +++ b/t/thread-cycle.t @@ -1,10 +1,11 @@ -# Copyright (C) 2016-2018 all contributors +# Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ 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'; @@ -19,12 +20,13 @@ sub make_objs { 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}, ]); push @simples, $simple; - bless $msg, 'PublicInbox::SearchMsg' + bless $msg, 'PublicInbox::Smsg' } @_; (\@simples, \@msgs); } @@ -100,13 +102,13 @@ done_testing(); 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}}; }