New (but not really complete)
[ZOOM-Perl-moved-to-github.git] / t / 13-resultset.t
1 # $Id: 13-resultset.t,v 1.1 2005-11-01 11:55:07 mike Exp $
2
3 # Before `make install' is performed this script should be runnable with
4 # `make test'. After `make install' it should work as `perl 13-resultset.t'
5
6 use strict;
7 use warnings;
8 use Test::More tests => 21;
9 BEGIN { use_ok('Net::Z3950::ZOOM') };
10
11 my($errcode, $errmsg, $addinfo) = (undef, "dummy", "dummy");
12
13 my $host = "indexdata.com/gils";
14 my $conn = Net::Z3950::ZOOM::connection_new($host, 0);
15 $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
16 ok($errcode == 0, "connection to '$host'");
17
18 my $query = '@attr 1=4 minerals';
19 my $rs = Net::Z3950::ZOOM::connection_search_pqf($conn, $query);
20 $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo);
21 ok($errcode == 0, "search for '$query'");
22
23 my $syntax = "usmarc";
24 Net::Z3950::ZOOM::resultset_option_set($rs, preferredRecordSyntax => $syntax);
25 my $val = Net::Z3950::ZOOM::resultset_option_get($rs, "preferredRecordSyntax");
26 ok($val eq $syntax, "preferred record syntax set to '$val'");
27
28 Net::Z3950::ZOOM::resultset_destroy($rs);
29 ok(1, "destroyed result-set");
30 Net::Z3950::ZOOM::connection_destroy($conn);
31 ok(1, "destroyed connection");