line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Query_Test.pl |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# Author: Alan K. Stebbens |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
7122
|
use Term::Query qw( query ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Tester; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# General a test on query with input, and check against the expected |
9
|
|
|
|
|
|
|
# response. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# This is used in the class tests. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub query_test { |
14
|
|
|
|
|
|
|
my $class = shift; |
15
|
|
|
|
|
|
|
my $test = shift; |
16
|
|
|
|
|
|
|
my $inputstring = shift; |
17
|
|
|
|
|
|
|
my $qargs = shift; |
18
|
|
|
|
|
|
|
my $condition = shift; |
19
|
|
|
|
|
|
|
local $_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Tester::run_test_with_input $class, $test, $inputstring, |
22
|
|
|
|
|
|
|
sub { |
23
|
|
|
|
|
|
|
$_ = query @_; |
24
|
|
|
|
|
|
|
exit if /^\s*(exit|quit|abort)\s*$/; |
25
|
|
|
|
|
|
|
printf "Answer = \"%s\"\n",(length($_) ? $_ : |
26
|
|
|
|
|
|
|
defined($_) ? 'NULL' : 'undef'); |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
$qargs, $condition; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |