/[webpac2]/trunk/t/2-parse.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/2-parse.t

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

revision 698 by dpavlin, Mon Sep 25 11:14:53 2006 UTC revision 705 by dpavlin, Mon Sep 25 13:46:36 2006 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use strict;  use strict;
4  use Test::More tests => 26;  use Test::More tests => 36;
5  use Test::Exception;  use Test::Exception;
6  use blib;  use blib;
7    
# Line 50  ok(! $parser->valid_database('non-exista Line 50  ok(! $parser->valid_database('non-exista
50  ok(! $parser->valid_database_input('foo','non-existant'), "no database input");  ok(! $parser->valid_database_input('foo','non-existant'), "no database input");
51    
52  ok(my $l = $parser->{_lookup_create}, "_lookup_create");  ok(my $l = $parser->{_lookup_create}, "_lookup_create");
53  diag "_lookup_create = ",dump($l);  diag "_lookup_create = ",dump($l) if ($debug);
54    foreach my $db (keys %$l) {
55            foreach my $i (keys %{$l->{$db}}) {
56                    foreach my $k (keys %{$l->{$db}->{$i}}) {
57                            ok(defined($parser->lookup_create_rules($db,$i)->{$k}), "have $db/$i/$k");
58                    }
59            }
60    }
61    
62  ok(my $n = $parser->{_normalize_source}, "_normalize_source");  ok(my $n = $parser->{_normalize_source}, "_normalize_source");
63  diag "_normalize_source = ",dump($n);  diag "_normalize_source = ",dump($n) if ($debug);
64    
65  ok(my $d = $parser->{depends}, "depends");  ok(my $d = $parser->{depends}, "depends");
66  diag "depends = ",dump($d);  diag "depends = ",dump($d) if ($debug);
67    
68  my $expected_depend = {  my $expected_depend = {
69     foo => {     foo => {
70              "foo-input1" => {              "foo-input1" => {
71                                bar => { "bar-input" => "200-a-200-e" },                                bar => { "bar-input" => { "210-a-210-e" => 1, "220-a-220-e" => 1, "230-a-230-e" => 1 } },
72                                baz => { "baz-input" => "200-a" },                                baz => { "baz-input" => { "200-a" => 1 } },
73                                foo => { "foo-input1" => 11, "foo-input2" => 11 },                                foo => { "foo-input1" => { 11 => 1 }, "foo-input2" => { 11 => 1 } },
74                              },                              },
75              "foo-input2" => {              "foo-input2" => {
76                                bar => { "bar-input" => "200-a-200-e" },                                bar => { "bar-input" => { "900-x" => 1 } },
77                                baz => { "baz-input" => "200-a" },                                baz => { "baz-input" => { "900-x" => 1 } },
78                                foo => { "foo-input1" => 11, "foo-input2" => 11 },                                foo => { "foo-input1" => { "245-a" => 1 }, "foo-input2" => { "245-a" => 1 } },
79                              },                              },
80            },            },
81     bar => { "bar-input" => { foo => { "foo-input1" => "245-a" } } },     bar => {
82     baz => { "baz-input" => { baz => { "baz-input" => "900-x" } } },              "bar-input" => {
83                      baz => { "baz-input" => { "900-x" => 1 } },
84                      foo => { "foo-input1" => { "245-a" => 1 } },
85                    },
86              },
87       baz => {
88                "baz-input" => {
89                      bar => { "bar-input" => { "900-x" => 1 } },
90                      foo => { "foo-input2" => { "245-a" => 1 } },
91                    },
92              },
93  };  };
94    
95    
# Line 83  foreach my $db (keys %$d) { Line 100  foreach my $db (keys %$d) {
100                  is_deeply($d->{$db}->{$i}, $parser->depends($db,$i), "depend $db/$i");                  is_deeply($d->{$db}->{$i}, $parser->depends($db,$i), "depend $db/$i");
101          }          }
102  }  }
103    

Legend:
Removed from v.698  
changed lines
  Added in v.705

  ViewVC Help
Powered by ViewVC 1.1.26