diff options
author | Eric Wong <e@80x24.org> | 2021-09-19 12:50:29 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-19 19:52:58 +0000 |
commit | 67fe4d8d90ac77419c8fc41457c849aa7d366a9d (patch) | |
tree | 5260306802492ad4edf8efe8879ca212d92b35a3 /t | |
parent | 7381166453ea76bef14403feb662d1e8bfccd209 (diff) | |
download | public-inbox-67fe4d8d90ac77419c8fc41457c849aa7d366a9d.tar.gz |
While NNTP ranges was already working, fetching a single message was broken. We'll also simplify the code a bit and ensure incremental synchronization is ignored when ranges are specified.
Diffstat (limited to 't')
-rw-r--r-- | t/lei-import-nntp.t | 26 | ||||
-rw-r--r-- | t/uri_nntps.t | 3 |
2 files changed, 29 insertions, 0 deletions
diff --git a/t/lei-import-nntp.t b/t/lei-import-nntp.t index f2c35406..1eb41e0e 100644 --- a/t/lei-import-nntp.t +++ b/t/lei-import-nntp.t @@ -37,5 +37,31 @@ test_lei({ tmpdir => $tmpdir }, sub { ok(-s $f, 'mail_sync exists tracked for redundant imports'); lei_ok 'ls-mail-sync'; like($lei_out, qr!\A\Q$url\E\n\z!, 'ls-mail-sync output as-expected'); + + ok(!lei(qw(import), "$url/12-1"), 'backwards range rejected'); + + # new home + local $ENV{HOME} = "$tmpdir/h2"; + lei_ok(qw(ls-mail-source -l), $url); + my $ls = json_utf8->decode($lei_out); + my ($high, $low) = @{$ls->[0]}{qw(high low)}; + ok($high > $low, 'high > low'); + + my $end = $high - 1; + lei_ok qw(import), "$url/$high"; + lei_ok qw(q z:0..); my $one = json_utf8->decode($lei_out); + pop @$one; # trailing null + is(scalar(@$one), 1, 'only 1 result'); + + local $ENV{HOME} = "$tmpdir/h3"; + lei_ok qw(import), "$url/$low-$end"; + lei_ok qw(q z:0..); my $start = json_utf8->decode($lei_out); + pop @$start; # trailing null + is(scalar(@$start), scalar(map { $_ } ($low..$end)), + 'range worked as expected'); + my %seen; + for (@$start, @$one) { + is($seen{$_->{blob}}++, 0, "blob $_->{blob} seen once"); + } }); done_testing; diff --git a/t/uri_nntps.t b/t/uri_nntps.t index babd8088..6b123a9b 100644 --- a/t/uri_nntps.t +++ b/t/uri_nntps.t @@ -37,4 +37,7 @@ is(PublicInbox::URInntps->new('nntps://0:563/')->canonical->as_string, $uri = PublicInbox::URInntps->new('nntps://NSA:Hunter2@0/inbox'); is($uri->userinfo, 'NSA:Hunter2', 'userinfo accepted w/ pass'); +$uri = PublicInbox::URInntps->new('nntps://NSA:Hunter2@0/inbox.test/9-10'); +is_deeply([$uri->group], [ 'inbox.test', 9, 10 ], 'ranges work'); + done_testing; |