From: mike Date: Mon, 3 Apr 2006 17:23:56 +0000 (+0000) Subject: New X-Git-Tag: cpan_1_22~239 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=c8f4bd4dd3f4c993f8ead2edc05ebff000377a6e;p=ZOOM-Perl-moved-to-github.git New --- diff --git a/t/28-charset.t b/t/28-charset.t new file mode 100644 index 0000000..6e88351 --- /dev/null +++ b/t/28-charset.t @@ -0,0 +1,41 @@ +# $Id: 28-charset.t,v 1.1 2006-04-03 17:23:56 mike Exp $ + +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 28-charset.t' + +use strict; +use warnings; +use Test::More tests => 9; + +BEGIN { use_ok('ZOOM') }; + +my $host = "z3950.loc.gov:7090/voyager"; +my $conn; +eval { $conn = new ZOOM::Connection($host) }; +ok(!$@, "connection to '$host'"); + +$conn->option(preferredRecordSyntax => 'usmarc'); + +my $qstr = '@attr 1=1003 gunter'; +my $rs; +eval { $rs = $conn->search_pqf($qstr) }; +ok(!$@, "search for '$qstr'"); + +my $n = $rs->size(); +ok($n == 10000, "found $n records (expected 10000)"); + +my $rec = $rs->record(0); +ok(defined $rec, "got first record"); + +my $xml = $rec->get('xml'); +ok(defined $xml, "got XML"); + +ok($xml =~ m(10\. .* f\350ur), + "got MARC pre-accented composed characters"); + +$xml = $rec->get('xml', 'charset=marc-8,utf-8'); +ok(defined $xml, "got XML in Unicode"); + +ok($xml =~ m(10\. .* für), + "got Unicode post-accented composed characters"); +