X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=t%2F14-sorting.t;h=30debe83e8cb877f6cfc6e5e51b2a4b63ee82145;hb=66e3742da2b4a7354a29a5a877d195f399bd1ee5;hp=dc2a0448b9c0c89f5423b7183fb6cb3c870006d7;hpb=d681c0e12cb18fbe4ef2ad4fbc49f74c81429c51;p=ZOOM-Perl-moved-to-github.git diff --git a/t/14-sorting.t b/t/14-sorting.t index dc2a044..30debe8 100644 --- a/t/14-sorting.t +++ b/t/14-sorting.t @@ -1,23 +1,11 @@ -# $Id: 14-sorting.t,v 1.3 2005-11-04 16:59:55 mike Exp $ +# $Id: 14-sorting.t,v 1.6 2005-11-18 17:53:53 mike Exp $ # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 14-sorting.t' -# ### At present, this test fails -- so far as I can see, because -# the underlying ZOOM-C sorting functionality is broken, as -# verified using "zoomsh" with the commands: -# -# ZOOM>open indexdata.dk/gils -# ZOOM>find @attr 1=4 map -# ZOOM>sort 1=4 -# ZOOM>show 0 5 -# -# Hopefully Adam will fix the underlying code, and then this -# will Just Work. - use strict; use warnings; -use Test::More tests => 27; +use Test::More tests => 29; use MARC::Record; BEGIN { use_ok('Net::Z3950::ZOOM') }; @@ -53,9 +41,12 @@ foreach my $i (1 .. $n) { $previous = $title; } -# Now reverse the order of sorting -Net::Z3950::ZOOM::resultset_sort($rs, "dummy", "1=4 >i"); -### There's no way to check for success, as this is a void function +# Now reverse the order of sorting. We never use resultset_sort(), +# which is identical to sort1() except that it returns nothing. +my $status = Net::Z3950::ZOOM::resultset_sort1($rs, "yaz", "1=4>i"); +ok($status < 0, "malformed sort criterion rejected"); +$status = Net::Z3950::ZOOM::resultset_sort1($rs, "yaz", "1=4 >i"); +ok($status == 0, "sort criterion accepted"); $previous = "z"; # Sorts after all legitimate titles foreach my $i (1 .. $n) {