about summary refs log tree commit homepage
path: root/t/over.t
diff options
context:
space:
mode:
Diffstat (limited to 't/over.t')
-rw-r--r--t/over.t27
1 files changed, 26 insertions, 1 deletions
diff --git a/t/over.t b/t/over.t
index 4c8f8098..1f2df7cf 100644
--- 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;
@@ -74,4 +74,29 @@ SKIP: {
                 'WAL journal_mode not clobbered if manually set');
 }
 
+# ext index additions
+$over->eidx_prep;
+{
+        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');
+
+        is($over->dbh->do(<<''), 1, 'remove first');
+DELETE FROM xref3 WHERE xnum = 2019 AND docid = 1349
+
+        $xref3 = $over->get_xref3(1349);
+        is_deeply($xref3, [ 'example.kee:2018:deadbeefcafe' ],
+                'confirm removal successful');
+        $over->rollback_lazy;
+}
+
 done_testing();