X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=t%2F15-scan.t;h=fb2ea32de842f149a0c2e160b908c56bc57884b6;hb=020448731710e235062c5b439e1e0939c56c7b2d;hp=beaf1bd71b297f68f90a90f639408b06583a312d;hpb=3c219af67e67909e1cfd606bc9e908b1ec2c5b5f;p=ZOOM-Perl-moved-to-github.git diff --git a/t/15-scan.t b/t/15-scan.t index beaf1bd..fb2ea32 100644 --- a/t/15-scan.t +++ b/t/15-scan.t @@ -1,4 +1,4 @@ -# $Id: 15-scan.t,v 1.4 2005-11-09 16:47:42 mike Exp $ +# $Id: 15-scan.t,v 1.7 2005-12-19 17:39:58 mike Exp $ # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 15-scan.t' @@ -76,7 +76,7 @@ ok(Net::Z3950::ZOOM::scanset_option_get($ss, "position") == 0, "seed-term before start of returned list"); # Silly test of option setting and getting -Net::Z3950::ZOOM::scanset_option_set($ss, "position", "fruit"); +Net::Z3950::ZOOM::scanset_option_set($ss, position => "fruit"); ok(Net::Z3950::ZOOM::scanset_option_get($ss, "position") eq "fruit", "option setting/getting works"); @@ -88,14 +88,25 @@ ok(1, "destroyed fourth scanset"); # returns display terms different from its terms. +my $use_query_for_scan = 0; sub scan { my($conn, $startterm, $nexpected) = @_; - $ss = Net::Z3950::ZOOM::connection_scan($conn, $startterm); + # Alternately use the original scan() interface and new scan1() + my $ss; + if ($use_query_for_scan) { + my $q = Net::Z3950::ZOOM::query_create(); + Net::Z3950::ZOOM::query_prefix($q, $startterm); + $ss = Net::Z3950::ZOOM::connection_scan1($conn, $q); + } else { + $ss = Net::Z3950::ZOOM::connection_scan($conn, $startterm); + } + $use_query_for_scan = !$use_query_for_scan; + $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo); ok($errcode == 0, "scan for '$startterm'"); $n = Net::Z3950::ZOOM::scanset_size($ss); ok(defined $n, "got size"); - ok($n == $nexpected, "got $n terms (expected $n)"); + ok($n == $nexpected, "got $n terms (expected $nexpected)"); return ($ss, $n); }