X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fpsgi_search.t;h=2f033016ef8272d0699e2628ac212553a52822c3;hb=cfb8d16578e7f2f2e300f9f436205e4a8fc7f322;hp=cc9c9cf42f2b714cbcbf57c0f5e856b9aa1cf331;hpb=09f1e000734bc431ec7b63e18959bf6f34f9c179;p=public-inbox.git
diff --git a/t/psgi_search.t b/t/psgi_search.t
index cc9c9cf4..2f033016 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2017 all contributors
+# Copyright (C) 2017-2018 all contributors
# License: AGPL-3.0+
use strict;
use warnings;
@@ -30,8 +30,7 @@ EOF
my $num = 0;
# nb. using internal API, fragile!
-my $xdb = $rw->_xdb_acquire;
-$xdb->begin_transaction;
+$rw->begin_txn_lazy;
foreach (reverse split(/\n\n/, $data)) {
$_ .= "\n";
@@ -42,8 +41,7 @@ foreach (reverse split(/\n\n/, $data)) {
ok($doc_id, 'message added: '. $mid);
}
-$xdb->commit_transaction;
-$rw = undef;
+$rw->commit_txn_lazy;
my $cfgpfx = "publicinbox.test";
my $config = PublicInbox::Config->new({
@@ -64,6 +62,16 @@ test_psgi(sub { $www->call(@_) }, sub {
is('%C3%86var', (keys %uniq)[0], 'matches original query');
ok(index($html, 'by Ævar Arnfjörð Bjarmason') >= 0,
"displayed Ãvar's name properly in HTML");
+
+ my $warn = [];
+ local $SIG{__WARN__} = sub { push @$warn, @_ };
+ $res = $cb->(GET('/test/?q=s:test&l=5e'));
+ is($res->code, 200, 'successful search result');
+ is_deeply([], $warn, 'no warnings from non-numeric comparison');
+
+ $res = $cb->(POST('/test/?q=s:bogus&x=m'));
+ is($res->code, 404, 'failed search result gives 404');
+ is_deeply([], $warn, 'no warnings');
});
done_testing();