--- trunk/t/2-parse.t 2006/09/24 21:13:40 692 +++ trunk/t/2-parse.t 2006/09/25 13:24:25 704 @@ -1,7 +1,7 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 20; +use Test::More tests => 26; use Test::Exception; use blib; @@ -55,3 +55,41 @@ ok(my $n = $parser->{_normalize_source}, "_normalize_source"); diag "_normalize_source = ",dump($n); +ok(my $d = $parser->{depends}, "depends"); +diag "depends = ",dump($d); + +my $expected_depend = { + foo => { + "foo-input1" => { + bar => { "bar-input" => { "210-a-210-e" => 1, "220-a-220-e" => 1, "230-a-230-e" => 1 } }, + baz => { "baz-input" => { "200-a" => 1 } }, + foo => { "foo-input1" => { 11 => 1 }, "foo-input2" => { 11 => 1 } }, + }, + "foo-input2" => { + bar => { "bar-input" => { "900-x" => 1 } }, + baz => { "baz-input" => { "900-x" => 1 } }, + foo => { "foo-input1" => { "245-a" => 1 }, "foo-input2" => { "245-a" => 1 } }, + }, + }, + bar => { + "bar-input" => { + baz => { "baz-input" => { "900-x" => 1 } }, + foo => { "foo-input1" => { "245-a" => 1 } }, + }, + }, + baz => { + "baz-input" => { + bar => { "bar-input" => { "900-x" => 1 } }, + foo => { "foo-input2" => { "245-a" => 1 } }, + }, + }, +}; + + +is_deeply($d, $expected_depend, "depends correct"); + +foreach my $db (keys %$d) { + foreach my $i (keys %{$d->{$db}}) { + is_deeply($d->{$db}->{$i}, $parser->depends($db,$i), "depend $db/$i"); + } +}