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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 949 - (hide annotations)
Thu Nov 1 00:16:48 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1043 byte(s)
 r1433@llin:  dpavlin | 2007-10-31 22:48:02 +0100
 HUGE swiping changes to implement new testing architecture
 based on all new WebPAC::Test module which makes
 test writing a joy

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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26