X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=t%2Fthread-cycle.t;h=1e5dfb51ab47a2865f9ab7835eda154291a5e65e;hp=4b47c01c37c1c9b81b4a684c85d2326323f62d3b;hb=4eee5af6011cc8cdefb66c9729952c7eff5c0b0b;hpb=c2b4e6111a561095d5155402d6900dae09b704eb diff --git a/t/thread-cycle.t b/t/thread-cycle.t index 4b47c01c..1e5dfb51 100644 --- a/t/thread-cycle.t +++ b/t/thread-cycle.t @@ -96,12 +96,31 @@ if ('sorting by Date') { is("\n".$backward, "\n".$forward, 'forward and backward matches'); } -done_testing(); +SKIP: { + require_mods 'Devel::Cycle', 1; + Devel::Cycle->import('find_cycle'); + my @dup = ( + { mid => 5, references => '<6>' }, + { mid => 5, references => '<6> <1>' }, + ); + open my $fh, '+>', \(my $out = '') or xbail "open: $!"; + (undef, $smsgs) = $make_objs->(@dup); + eval 'package EmptyInbox; sub smsg_by_mid { undef }'; + my $ctx = { ibx => bless {}, 'EmptyInbox' }; + my $rootset = PublicInbox::SearchThread::thread($smsgs, sub { + @{$_[0]} = sort { $a->{mid} cmp $b->{mid} } @{$_[0]} }, $ctx); + my $oldout = select $fh; + find_cycle($rootset); + select $oldout; + is($out, '', 'nothing from find_cycle'); +} # Devel::Cycle check + +done_testing; sub thread_to_s { my ($msgs) = @_; my $rootset = PublicInbox::SearchThread::thread($msgs, sub { - [ sort { $a->{mid} cmp $b->{mid} } @{$_[0]} ] }); + @{$_[0]} = sort { $a->{mid} cmp $b->{mid} } @{$_[0]} }); my $st = ''; my @q = map { (0, $_) } @$rootset; while (@q) {