diff options
author | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-22 03:06:56 +0000 |
---|---|---|
committer | Eric Wong (Contractor, The Linux Foundation) <e@80x24.org> | 2018-03-22 03:06:56 +0000 |
commit | 4048e3c000ee6659a5754dea697a1b77a8022bbd (patch) | |
tree | 5c8cd75ef5a897514cab0a5f09641c5303a2d3c7 | |
parent | 3a4394468b4a9affc38f8e0f56011adb72269ec2 (diff) | |
download | public-inbox-4048e3c000ee6659a5754dea697a1b77a8022bbd.tar.gz |
I'll be relying on some of this behavior for regenerating NNTP article numbers off fresh clones.
-rw-r--r-- | t/altid.t | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -20,7 +20,9 @@ my $altid = [ "serial:gmane:file=$alt_file" ]; { my $mm = PublicInbox::Msgmap->new_file($alt_file, 1); - $mm->mid_set(1234, 'a@example.com'); + is($mm->mid_set(1234, 'a@example.com'), 1, 'mid_set once OK'); + ok(0 == $mm->mid_set(1234, 'a@example.com'), 'mid_set not idempotent'); + ok(0 == $mm->mid_set(1, 'a@example.com'), 'mid_set fails with dup MID'); } { @@ -56,6 +58,13 @@ my $altid = [ "serial:gmane:file=$alt_file" ]; is($res->{total}, 0, 'body did NOT match'); }; +{ + my $mm = PublicInbox::Msgmap->new_file($alt_file, 1); + my ($min, $max) = $mm->minmax; + my $num = $mm->mid_insert('b@example.com'); + ok($num > $max, 'auto-increment goes beyond mid_set'); +} + done_testing(); 1; |