]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/over.t
update copyrights for 2021
[public-inbox.git] / t / over.t
index 3e2860f8f96d0d40805b72f5b954b79e5970c67b..a92d2f77b0397012121d24a155ff32aa9bb8acf7 100644 (file)
--- a/t/over.t
+++ b/t/over.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
@@ -75,14 +75,27 @@ SKIP: {
 }
 
 # ext index additions
+$over->eidx_prep;
 {
-       my $hex = 'deadbeefcafe';
-       my $n = $over->oid_add($hex);
-       ok($n > 0, 'oid_add returned number');
-       is($over->oid2num($hex), $n, 'oid2num works');
-       my $n2 = $over->oid_add($hex.$hex);
-       ok($n2 > $n, 'oid_add increments');
-       is($over->oid2num($hex.$hex), $n2, 'oid2num works again');
+       my @arg = qw(1349 2019 adeadba7cafe example.key);
+       ok($over->add_xref3(@arg), 'first add');
+       ok($over->add_xref3(@arg), 'add idempotent');
+       my $xref3 = $over->get_xref3(1349);
+       is_deeply($xref3, [ 'example.key:2019:adeadba7cafe' ], 'xref3 works');
+
+       @arg = qw(1349 2018 deadbeefcafe example.kee);
+       ok($over->add_xref3(@arg), 'add another xref3');
+       $xref3 = $over->get_xref3(1349);
+       is_deeply($xref3, [ 'example.key:2019:adeadba7cafe',
+                       'example.kee:2018:deadbeefcafe' ],
+                       'xref3 works forw two');
+
+       @arg = qw(1349 adeadba7cafe example.key);
+       is($over->remove_xref3(@arg), 1, 'remove first');
+       $xref3 = $over->get_xref3(1349);
+       is_deeply($xref3, [ 'example.kee:2018:deadbeefcafe' ],
+               'confirm removal successful');
+       $over->rollback_lazy;
 }
 
 done_testing();