/[webpac2]/trunk/t/3-normalize-set.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

Diff of /trunk/t/3-normalize-set.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 471 by dpavlin, Sat May 13 12:07:37 2006 UTC revision 472 by dpavlin, Sat May 13 12:07:46 2006 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 25;  use Test::More tests => 42;
6  use Test::Exception;  use Test::Exception;
7  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
8  use blib;  use blib;
9  use File::Slurp;  use File::Slurp;
10    
11  use Data::Dumper;  use Data::Dumper;
12  my $debug = 0;  my $debug = shift @ARGV;
13    
14  BEGIN {  BEGIN {
15          use_ok( 'WebPAC::Normalize::Set' );          use_ok( 'WebPAC::Normalize::Set' );
# Line 208  sub test_s { Line 208  sub test_s {
208          ok(my $ds = get_ds(), "get_ds");          ok(my $ds = get_ds(), "get_ds");
209          diag "ds = ", Dumper($ds) if ($debug);          diag "ds = ", Dumper($ds) if ($debug);
210    
         clean_ds();  
211    
212            sub test_check_ds {
213    
214                    my $t = shift;
215    
216                    ok($ds = get_ds(), 'get_ds');
217                    diag Dumper( $ds ) if ($debug);
218    
219                    ok( $ds && $ds->{something}, 'get_ds->something exists' );
220                    ok( $ds && $ds->{something}->{$t}, 'get_ds->something->'.$t.' exists') if ($t);
221                    ok( $ds && !$ds->{empty}, 'get_ds->empty doesn\'t' );
222    
223                    return $ds;
224            }
225    
226            clean_ds();
227          test_s(qq{ search('something', '42'); });          test_s(qq{ search('something', '42'); });
228          test_s(qq{ search('empty', ''); });          test_s(qq{ search('empty', ''); });
229            test_check_ds('search');
230    
231          ok($ds = get_ds(), 'get_ds');          clean_ds();
232          diag Dumper( $ds ) if ($debug);          test_s(qq{ display('something', '42'); });
233            test_s(qq{ display('empty', ''); });
234          ok( $ds && $ds->{something}, 'get_ds->something' );          test_check_ds('display');
         ok( $ds && !$ds->{empty}, 'get_ds->empty' );  
235    
236          clean_ds();          clean_ds();
237            test_s(qq{ tag('something', '42'); });
238            test_s(qq{ tag('empty', ''); });
239            test_check_ds('search');
240            test_check_ds('display');
241    
242            clean_ds();
243          my $n = read_file( "$abs_path/data/normalize.pl" );          my $n = read_file( "$abs_path/data/normalize.pl" );
244          $n .= "\n1;\n";          $n .= "\n1;\n";
245          #diag "normalize code:\n$n\n";          #diag "normalize code:\n$n\n";

Legend:
Removed from v.471  
changed lines
  Added in v.472

  ViewVC Help
Powered by ViewVC 1.1.26