2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
use Test::More tests => 33; |
use Test::More tests => 49; |
6 |
|
|
7 |
BEGIN { |
BEGIN { |
8 |
use_ok('DBI'); |
use_ok('DBI'); |
33 |
|
|
34 |
sub pgest { |
sub pgest { |
35 |
$sth->execute(@_) || die $sth->errstr(); |
$sth->execute(@_) || die $sth->errstr(); |
36 |
ok($sth, "execute(".join(",",@_).")"); |
{ |
37 |
|
no warnings; |
38 |
|
ok($sth, "execute(".join(",",@_).")"); |
39 |
|
} |
40 |
|
|
41 |
my @arr; |
my @arr; |
42 |
while (my $row = $sth->fetchrow_hashref() ) { |
while (my $row = $sth->fetchrow_hashref() ) { |
86 |
cmp_ok(scalar pgest('', $q, 0, 0), '==', $hits, 'blade runner'); |
cmp_ok(scalar pgest('', $q, 0, 0), '==', $hits, 'blade runner'); |
87 |
} |
} |
88 |
|
|
89 |
|
diag "Error handling test follows, ignore messages..."; |
90 |
|
# test NULL handling |
91 |
|
ok(! $dbh->do(qq{select * from pgest(null, '', '', 0, 0)}), "null index_path"); |
92 |
|
ok(my $hits = pgest('blade runner', '', 0, 0), "test search"); |
93 |
|
cmp_ok($hits, '==', pgest('blade runner', undef, 0, 0), "null attr"); |
94 |
|
cmp_ok($hits, '==', pgest('blade runner', '', undef, 0), "null limit"); |
95 |
|
cmp_ok($hits, '==', pgest('blade runner', '', 0, undef), "null offset"); |
96 |
|
cmp_ok($hits, '==', pgest('blade runner', undef, undef, undef), "null optional"); |
97 |
|
|