From c26d9cc923f8eac4389d462b2997a057fac20dfc Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 23 May 2006 18:17:12 +0000 Subject: [PATCH] add checking for isa fields in Help --- t/Help/related.t | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/t/Help/related.t b/t/Help/related.t index 079c6f773..167313867 100644 --- a/t/Help/related.t +++ b/t/Help/related.t @@ -16,9 +16,11 @@ use WebGUI::Test; use WebGUI::Session; use WebGUI::Operation::Help; +use Data::Dumper; + #The goal of this test is to verify that all entries in the lib/WebGUI/Help #directory correctly resolve to other Help entries. The total number of -#tests will be dynamic, based on how many "related" entries are set up +#tests will be dynamic, based on how many "related" and "isa" entries are set up #in the Help files. Calling Test::plan will be delayed. use Test::More; @@ -39,19 +41,26 @@ foreach my $helpSet (@helpFileSet) { ##Scan #1, how many tests do we expect? my @relatedHelp = (); +my @isaHelp = (); foreach my $topic ( keys %helpTable ) { foreach my $entry ( keys %{ $helpTable{$topic} }) { my @related = WebGUI::Operation::Help::_related($session, $helpTable{$topic}{$entry}{related}); - foreach my $relHash (@related) { + foreach my $relHash (@related) { ##Inplace modify $relHash->{parentEntry} = $entry; $relHash->{parentTopic} = $topic; } push @relatedHelp, @related; - $numTests += scalar @related; + if ( scalar keys %{ $helpTable{$topic}{$entry}{isa} } > 0 ) { + my $isaHash = $helpTable{$topic}{$entry}{isa}; + $isaHash->{parentEntry} = $entry; + $isaHash->{parentTopic} = $topic; + push @isaHelp, $isaHash; + } } } -plan tests => $numTests; + +plan tests => scalar @relatedHelp + scalar @isaHelp; ##Each array element is a hash with two keys, tag (entry) and namespace (topic). @@ -59,3 +68,8 @@ foreach my $related (@relatedHelp) { my ($topic, $entry, $parentTopic, $parentEntry) = @{ $related }{'namespace', 'tag', 'parentTopic', 'parentEntry'}; ok( exists $helpTable{$topic}{$entry}, "Help entry: $topic -> $entry from $parentTopic -> $parentEntry"); } + +foreach my $isa (@isaHelp) { + my ($topic, $entry, $parentTopic, $parentEntry) = @{ $isa }{'namespace', 'tag', 'parentTopic', 'parentEntry'}; + ok( exists $helpTable{$topic}{$entry}, "Help entry: $topic -> $entry from $parentTopic -> $parentEntry"); +}