X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fmsgmap.t;h=dce98f46b6f57e48a90653ceba659a3665db247d;hb=be4d92e74dd0b1c8de85bc08c3c522af2d8d8656;hp=5c28e54df7542b7031081e5a37cecfa803a68c05;hpb=5cddfa50765d59157e15488c235fe01202db0972;p=public-inbox.git diff --git a/t/msgmap.t b/t/msgmap.t index 5c28e54d..dce98f46 100644 --- a/t/msgmap.t +++ b/t/msgmap.t @@ -1,5 +1,5 @@ -# Copyright (C) 2015 all contributors -# License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt) +# Copyright (C) 2015-2018 all contributors +# License: AGPL-3.0+ use strict; use warnings; use Test::More; @@ -27,9 +27,9 @@ foreach my $mid (@mids) { } $@ = undef; -eval { $d->mid_insert('a@b') }; -ok($@, 'error raised when attempting duplicate message ID'); - +my $ret = $d->mid_insert('a@b'); +is($ret, undef, 'duplicate mid_insert in undef result'); +is($d->num_for('a@b'), $mid2num{'a@b'}, 'existing number not clobbered'); foreach my $n (keys %num2mid) { is($d->mid_for($n), $num2mid{$n}, "num:$n maps correctly"); @@ -65,4 +65,8 @@ my $orig = $d->mid_insert('spam@1'); $d->mid_delete('spam@1'); is($d->mid_insert('spam@2'), 1 + $orig, "last number not recycled"); +my $tmp = $d->tmp_clone; +is_deeply([$d->minmax], [$tmp->minmax], 'Cloned temporary DB matches'); +ok($tmp->mid_delete('spam@2'), 'temporary DB is writable'); + done_testing();