/[webpac2]/trunk/t/5-output-webpacus.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/5-output-webpacus.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 993 - (hide annotations)
Sun Nov 4 14:43:47 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: application/x-troff
File size: 981 byte(s)
 r1525@llin:  dpavlin | 2007-11-04 15:34:13 +0100
 added consume_outputs which returns all output types this plugin supports.
 This will eventually come in handy for main loop to decide which outputs to
 call...

1 dpavlin 932 #!/usr/bin/perl -w
2    
3 dpavlin 949 use strict;
4 dpavlin 932 use blib;
5    
6 dpavlin 993 use Test::More tests => 11;
7 dpavlin 949
8 dpavlin 932 BEGIN {
9 dpavlin 949 use_ok( 'WebPAC::Test' );
10 dpavlin 932 use_ok( 'WebPAC::Output::Webpacus' );
11     }
12    
13     ok(my $out = new WebPAC::Output::Webpacus({
14     path => '/data/Webpacus2/',
15     database => 'test',
16     clean => 1,
17 dpavlin 949 %LOG
18 dpavlin 932 }), "new");
19    
20 dpavlin 993 ok( $out->consume_outputs, 'consume_outputs' );
21    
22     diag "consume_outputs = ",dump( $out->consume_outputs ) if $debug;
23    
24 dpavlin 932 ok( $out->init, 'init' );
25    
26     my $ds = {
27     'Source' => {
28     'name' => 'Izvor: ',
29     'sorted' => [ 'foo' ]
30     },
31     'ID' => {
32     'sorted' => 'id',
33     },
34     'Array' => {
35     'sorted' => [ qw/a1 a2 s3 a4 a5/ ],
36     },
37     };
38    
39     throws_ok { $out->add( ) } qr/need id/, 'add without params';
40     throws_ok { $out->add( 42 ) } qr/need ds/, 'add without ds';
41    
42     ok( $out->add( 42, $ds ), 'add 42' );
43    
44     ok( $out->add( 99, { foo => { sorted => 'bar' } } ), 'add 99' );
45    
46     ok( $out->add( 100, { foo => { sorted => [ qw/foo bar baz/ ] } } ), 'add 100' );
47    
48 dpavlin 949 diag "path: ",$out->path if $debug;
49 dpavlin 932
50 dpavlin 993 cmp_ok( $out->finish, '==', 4, 'finish' );
51 dpavlin 932

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26