From 4048e3c000ee6659a5754dea697a1b77a8022bbd Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Thu, 22 Mar 2018 03:06:56 +0000 Subject: t/altid.t: extra tests for mid_set I'll be relying on some of this behavior for regenerating NNTP article numbers off fresh clones. --- t/altid.t | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/t/altid.t b/t/altid.t index 7759bd6b..0f3b86c1 100644 --- a/t/altid.t +++ b/t/altid.t @@ -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; -- cgit v1.2.3-24-ge0c7