We don't want non-fully-numeric limits being compared and
tripping warnings. While we're at it, avoid hard-coding
'200' and reuse $LIM as the default.
my ($class, $qp) = @_;
my $r = $qp->{r};
my ($class, $qp) = @_;
my $r = $qp->{r};
- my $l = $qp->{l} || '200';
- if (! ($l =~ /(\d+)/ && $l <= $LIM)) {
- $l = $LIM;
- }
+ my ($l) = (($qp->{l} || '') =~ /(\d+)/);
+ $l = $LIM if !$l || $l > $LIM;
bless {
q => $qp->{'q'},
x => $qp->{x} || '',
bless {
q => $qp->{'q'},
x => $qp->{x} || '',
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");
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');