about summary refs log tree commit homepage
diff options
context:
space:
mode:
-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;