/[webpac2]/trunk/t/6-unit.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/t/6-unit.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations)
Sun Jul 24 15:03:11 2005 UTC (18 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1624 byte(s)
re-worked logging, added no_log option to disable logging

1 dpavlin 22 #!/usr/bin/perl -w
2    
3     use strict;
4    
5     use Test::More tests => 23;
6     use Test::Exception;
7     use Cwd qw/abs_path/;
8     use File::Temp qw/tempdir/;
9     use blib;
10    
11     BEGIN {
12     use_ok( 'WebPAC::Lookup' );
13     use_ok( 'WebPAC::Input::ISIS' );
14     use_ok( 'WebPAC::DB' );
15     use_ok( 'WebPAC::Normalize::XML' );
16     use_ok( 'WebPAC::Output::TT' );
17     }
18    
19     ok(my $abs_path = abs_path($0), "abs_path");
20     $abs_path =~ s#/[^/]*$#/#;
21     diag "abs_path: $abs_path";
22    
23     my $isis_file = "$abs_path../t/winisis/BIBL";
24 dpavlin 31 $isis_file = '/data/hidra/THS/THS';
25 dpavlin 22
26     diag "isis_file: $isis_file";
27    
28     ok(my $lookup = new WebPAC::Lookup(
29     lookup_file => "$abs_path../conf/lookup/isis.pm",
30     ), "new Lookup");
31    
32     ok(my $isis = new WebPAC::Input::ISIS(
33     code_page => 'ISO-8859-2', # application encoding
34 dpavlin 31 limit_mfn => 10,
35 dpavlin 22 ), "new Input::ISIS");
36    
37     ok(my $maxmfn = $isis->open(
38     filename => $isis_file,
39     code_page => '852', # database encoding
40     ), "Input::ISIS->open");
41    
42     ok(my $path = tempdir( CLEANUP => 1 ), "path");
43    
44     ok(my $db = new WebPAC::DB(
45     path => $path,
46     ), "new DB");
47    
48     ok(my $n = new WebPAC::Normalize::XML(
49     # filter => { 'foo' => sub { shift } },
50     db => $db,
51     lookup_regex => $lookup->regex,
52 dpavlin 31 lookup => $lookup,
53 dpavlin 22 ), "new Normalize::XML");
54    
55     ok($n->open(
56     tag => 'isis',
57     xml_file => "$abs_path../conf/normalize/isis.xml",
58     ), "Normalize::XML->open");
59    
60     ok(my $out = new WebPAC::Output::TT(
61     include_path => "$abs_path../conf/output/tt",
62     filters => { foo => sub { shift } },
63     ), "new Output::TT");
64    
65     while (my $row = $isis->fetch) {
66    
67     ok(my @ds = $n->data_structure($row), "data_structure");
68    
69     use Data::Dumper;
70     print Dumper(\@ds);
71    
72     ok($out->apply(
73     template => 'html.tt',
74     data => @ds,
75     ), "apply");
76    
77     };

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26