]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/thread-cycle.t
searchthread: simplify API and remove needless OO
[public-inbox.git] / t / thread-cycle.t
index 9dd2aa3c64fcd6971285bb7857896172e748ede9..16ceee71f25e0c1bc46f0450729a22e625a96ae7 100644 (file)
@@ -72,11 +72,11 @@ SKIP: {
 done_testing();
 
 sub thread_to_s {
-       my $th = PublicInbox::SearchThread->new(shift);
-       $th->thread;
-       $th->order(sub { [ sort { $a->{id} cmp $b->{id} } @{$_[0]} ] });
+       my ($msgs) = @_;
+       my $rootset = PublicInbox::SearchThread::thread($msgs, sub {
+               [ sort { $a->{id} cmp $b->{id} } @{$_[0]} ] });
        my $st = '';
-       my @q = map { (0, $_) } @{$th->{rootset}};
+       my @q = map { (0, $_) } @$rootset;
        while (@q) {
                my $level = shift @q;
                my $node = shift @q or next;