New INSTALL.WIN doc (from wiki)
[bioperl-live.git] / t / Biblio_eutils.t
blobc8d1ddecc3ee9009a60336518237d64c0dee0eea
1 # This is -*-Perl-*- code
2 ## Bioperl Test Harness Script for Modules
3 ##
4 # $Id$
6 # Before `make install' is performed this script should be runnable with
7 # `make test'. After `make install' it should work as `perl test.t'
9 use strict;
10 use vars qw($NUMTESTS $DEBUG $error $msg);
12 BEGIN { 
13     $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
14     # to handle systems with no installed Test module
15     # we include the t dir (where a copy of Test.pm is located)
16     # as a fallback
17     eval { require Test; };
18     $error = 0;
19     if( $@ ) {
20         use lib 't';
21     }
22     use Test;
23     
24     plan tests => ($NUMTESTS = 5);
25     eval { require IO::String; };
26     if( $@ ) {
27         warn( "IO::String not installed. This means the Bio::DB::* modules are not usable. Skipping tests.\n") if $DEBUG;
28         $msg .= 'IO::String not installed. ';
29         $error = 1;
30     } 
31     eval { require LWP::Simple; };
32     if( $@ ) {
33         warn( "LWP::Simple not installed. This means the Bio::DB::* modules are not usable. Skipping tests.\n") if $DEBUG;
34         $msg .= 'LWP::Simple not installed. ';
35         $error = 1; 
36     }
39 exit(0) if $error;
41 END { 
42     foreach ( $Test::ntest..$NUMTESTS) {
43         skip($msg,1);
44     }
46 use Bio::Biblio;
48 ## End of black magic.
50 ## Insert additional test code below but remember to change
51 ## the print "1..x\n" in the BEGIN block to reflect the
52 ## total number of tests that will be run. 
54 my $db;
56 my $verbose =  $DEBUG || 0;
58 eval { 
59     ok ($db = new Bio::Biblio (-access => 'eutils',
60                                -verbose=>$verbose));
61     ok(defined($db->find('"Day A"[AU] AND ("Database Management Systems"[MH] OR "Databases, Genetic"[MH] OR "Software"[MH] OR "Software Design"[MH])')));
64 if ($@) {
65     warn "Warning: Couldn't connect to Eutils server!\n$@\n" if $DEBUG;
66     $msg = 'No network access - could not connect to PubMed Eutils';
67     exit(0);
70 while(my $xml = $db->get_next) {
71     ok(1);