do not check each help label multiple times
This commit is contained in:
parent
ed0e76c114
commit
e7ea7b3e1f
1 changed files with 9 additions and 8 deletions
|
|
@ -53,7 +53,6 @@ my @sqlLabels;
|
||||||
my @libLabels;
|
my @libLabels;
|
||||||
my @objLabels;
|
my @objLabels;
|
||||||
|
|
||||||
|
|
||||||
@helpLabels = getHelpLabels();
|
@helpLabels = getHelpLabels();
|
||||||
|
|
||||||
$numTests = scalar(@helpLabels);
|
$numTests = scalar(@helpLabels);
|
||||||
|
|
@ -68,6 +67,7 @@ foreach my $label ( @helpLabels ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub getHelpLabels {
|
sub getHelpLabels {
|
||||||
|
my %seenLabel = ();
|
||||||
my @helpLabels = ();
|
my @helpLabels = ();
|
||||||
foreach my $topic ( keys %helpTable ) {
|
foreach my $topic ( keys %helpTable ) {
|
||||||
foreach my $entry ( keys %{ $helpTable{$topic} }) {
|
foreach my $entry ( keys %{ $helpTable{$topic} }) {
|
||||||
|
|
@ -78,15 +78,15 @@ sub getHelpLabels {
|
||||||
tag=>'title',
|
tag=>'title',
|
||||||
namespace=>$topic, ##default
|
namespace=>$topic, ##default
|
||||||
label=>$helpTable{$topic}{$entry}{'title'},
|
label=>$helpTable{$topic}{$entry}{'title'},
|
||||||
};
|
} unless $seenLabel{$topic}{$helpTable{$topic}{$entry}{'title'}}++;
|
||||||
if (ref $helpTable{$topic}{$entry}{'body'} ne 'CODE') {
|
if ($helpTable{$topic}{$entry}{'body'} and ref $helpTable{$topic}{$entry}{'body'} ne 'CODE') {
|
||||||
push @helpLabels, {
|
push @helpLabels, {
|
||||||
topic=>$topic,
|
topic=>$topic,
|
||||||
entry=>$entry,
|
entry=>$entry,
|
||||||
tag=>'body',
|
tag=>'body',
|
||||||
namespace=>$topic, ##default
|
namespace=>$topic, ##default
|
||||||
label=>$helpTable{$topic}{$entry}{'body'},
|
label=>$helpTable{$topic}{$entry}{'body'},
|
||||||
} if $helpTable{$topic}{$entry}{'body'};
|
} unless $seenLabel{$topic}{$helpTable{$topic}{$entry}{'title'}}++;
|
||||||
}
|
}
|
||||||
|
|
||||||
##Add all labels in the fields array
|
##Add all labels in the fields array
|
||||||
|
|
@ -97,14 +97,14 @@ sub getHelpLabels {
|
||||||
tag=>'fields',
|
tag=>'fields',
|
||||||
namespace=>$field->{namespace},
|
namespace=>$field->{namespace},
|
||||||
label=>$field->{title},
|
label=>$field->{title},
|
||||||
},
|
} unless $seenLabel{$field->{namespace}}{$field->{title}}++;
|
||||||
{
|
push @helpLabels, {
|
||||||
topic=>$topic,
|
topic=>$topic,
|
||||||
entry=>$entry,
|
entry=>$entry,
|
||||||
tag=>'fields',
|
tag=>'fields',
|
||||||
namespace=>$field->{namespace},
|
namespace=>$field->{namespace},
|
||||||
label=>$field->{description},
|
label=>$field->{description},
|
||||||
},;
|
} unless $seenLabel{$field->{namespace}}{$field->{description}}++;
|
||||||
}
|
}
|
||||||
my $variableEntries = getHelpVariables($helpTable{$topic}{$entry}{variables});
|
my $variableEntries = getHelpVariables($helpTable{$topic}{$entry}{variables});
|
||||||
foreach my $variable ( @{ $variableEntries } ) {
|
foreach my $variable ( @{ $variableEntries } ) {
|
||||||
|
|
@ -121,7 +121,8 @@ sub getHelpLabels {
|
||||||
else {
|
else {
|
||||||
$one->{label} = $variable->{name},
|
$one->{label} = $variable->{name},
|
||||||
}
|
}
|
||||||
push @helpLabels, $one;
|
push @helpLabels, $one
|
||||||
|
unless $seenLabel{$namespace}{$one->{label}}++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue