about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-22 03:06:56 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-22 03:06:56 +0000
commit4048e3c000ee6659a5754dea697a1b77a8022bbd (patch)
tree5c8cd75ef5a897514cab0a5f09641c5303a2d3c7
parent3a4394468b4a9affc38f8e0f56011adb72269ec2 (diff)
downloadpublic-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.t11
1 files changed, 10 insertions, 1 deletions
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;