X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=t%2F22-query.t;h=e0b049fc502e599fa16b942c11d79e279f7e059c;hb=ce460f89feee123e409d9da994a8ea66e87942bb;hp=20e7fadd355855ad94907b6128e5550965adef17;hpb=5e9d44c23b12861a7c6df51ec31bb105fba6e128;p=ZOOM-Perl-moved-to-github.git diff --git a/t/22-query.t b/t/22-query.t index 20e7fad..e0b049f 100644 --- a/t/22-query.t +++ b/t/22-query.t @@ -1,11 +1,11 @@ -# $Id: 22-query.t,v 1.3 2005-12-22 08:30:15 mike Exp $ +# $Id: 22-query.t,v 1.6 2005-12-22 09:25:14 mike Exp $ # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 22-query.t' use strict; use warnings; -use Test::More tests => 31; +use Test::More tests => 32; BEGIN { use_ok('ZOOM') }; #ZOOM::Log::init_level(ZOOM::Log::mask_str("zoom")); @@ -67,7 +67,12 @@ $q->destroy(); ok(1, "[no need to create empty query]"); eval { $q = new ZOOM::Query::CQL('title=utah and description=epicenter') }; ok(!$@, "created CQL query"); -#check_failure($conn, $q, 107, "Bib-1"); +my $rs; +eval { $rs = $conn->search($q) }; +ok($@ && $@->isa("ZOOM::Exception") && + $@->code() == 107 && $@->diagset() eq "Bib-1", + "query rejected: error " . $@->code()); +$q->destroy(); # Client-side compiled CQL: this will fail due to lack of config-file ok(1, "[no need to create empty query]"); @@ -77,12 +82,14 @@ ok($@ && $@->isa("ZOOM::Exception") && $@->code() == ZOOM::Error::CQL_TRANSFORM && $@->diagset() eq "ZOOM", "can't make CQL2RPN query: error " . $@->code()); +# Finally, do a successful client-compiled CQL search ok(1, "[no need to create empty query]"); $conn->option(cqlfile => "samples/cql/pqf.properties"); eval { $q = new ZOOM::Query::CQL2RPN('title=utah and description=epicenter', $conn) }; ok(!$@, "created CQL2RPN query: \@=$@"); check_record($conn, $q); +$q->destroy(); $conn->destroy(); ok(1, "destroyed all objects"); @@ -108,15 +115,3 @@ sub check_record { $rs->destroy(); } - - -sub check_failure { - my($conn, $q, $expected_error, $expected_dset) = @_; - - my $rs; - eval { $rs = $conn->search($q) }; - ok($@ && $@->isa("ZOOM::Exception") && - $@->code() == $expected_error && $@->diagset() eq $expected_dset, - "query rejected: error " . $@->code()); - $rs->destroy(); -}