| 1 |
# Before `make install' is performed this script should be runnable with |
| 2 |
# `make test'. After `make install' it should work as `perl test.pl' |
| 3 |
|
| 4 |
use ExtUtils::testlib; |
| 5 |
use WWW::Search::Test qw( new_engine run_gui_test run_test skip_test ); |
| •6 |
use Test::More; |
| 7 |
|
| 8 |
######################### We start with some black magic to print on failure. |
| 9 |
|
| 10 |
# Change 1..1 below to 1..last_test_to_print . |
| 11 |
# (It may become useful if the test is moved to ./t subdirectory.) |
| 12 |
|
| 13 |
BEGIN { $| = 1; print "1..5\n"; } |
| 14 |
END {print "not ok 1\n" unless $loaded;} |
| 15 |
use WWW::Search::FirstGov; |
| 16 |
$loaded = 1; |
| 17 |
print "ok 1\n"; |
| 18 |
|
| 19 |
######################### End of black magic. |
| 20 |
|
| •21 |
unless ($ENV{NO_NETWORK}) { |
| 22 |
no_plan(); |
| 23 |
} |
| 24 |
else { |
| 25 |
plan skip_all => "no network"; |
| 26 |
} |
| 27 |
|
| 28 |
# Insert your test code below (better if it prints "ok 13" |
| 29 |
# (correspondingly "not ok 13") depending on the success of chunk 13 |
| 30 |
# of the test code): |
| 31 |
|
| 32 |
$WWW::Search::Test::iTest = 1; # let Test know that we've already done one test |
| 33 |
|
| 34 |
&new_engine('FirstGov'); |
| 35 |
|
| 36 |
my $debug = 0; |
| 37 |
|
| 38 |
# This test returns no results (but we should not get an HTTP error): |
| 39 |
&run_test($WWW::Search::Test::bogus_query, 0, 0, $debug); |
| 40 |
|
| 41 |
# This query returns 1 page of results: |
| 42 |
&run_test('ev' . 'il ja' . 'va jo' . 'ke ap' . 'ple no' . 'se odd' . 'ball', 1, 99, $debug); |
| 43 |
|
| 44 |
MULTI_TEST: |
| 45 |
# &skip_test; goto GUI_TEST; |
| 46 |
# This query returns MANY pages of results: |
| 47 |
&run_test('commerce', 101, undef, $debug); |
| 48 |
|