missed a revision in the last merge
This commit is contained in:
parent
f8b11b5423
commit
46a3620daf
1 changed files with 14 additions and 23 deletions
|
|
@ -19,6 +19,7 @@ use WebGUI::International;
|
|||
use WebGUI::Session;
|
||||
use Data::Dumper;
|
||||
use WebGUI::Asset::Template;
|
||||
use WebGUI::Macro::Callback;
|
||||
|
||||
#The goal of this test is to locate all of the international labels that it
|
||||
#can and verify that they exist in all loaded language models
|
||||
|
|
@ -30,24 +31,15 @@ plan skip_all => 'set CODE_COP to enable this test' unless $ENV{CODE_COP};
|
|||
my $session = WebGUI::Test->session;
|
||||
my $lib = WebGUI::Test->lib;
|
||||
|
||||
##Find the name of the International macro in the user's config file.
|
||||
my $configFileMacros = $session->config->get('macros');
|
||||
my %macroNameLookup = reverse %{ $configFileMacros };
|
||||
my $international;
|
||||
$international = (exists $macroNameLookup{'International'}) ? $macroNameLookup{'International'} : 'International';
|
||||
|
||||
#diag "International macro name = $international";
|
||||
|
||||
##Regexp setup for parsing out the Macro calls.
|
||||
my $bareword = qr/([^,)]+)/; ##Anything that's not a comma
|
||||
my $quotelike = qr/((['])([^'\s\$]+\s*)+([']))/;
|
||||
my $sub_args = qr/(($quotelike|$bareword)(?:,\s*)?)+/; ##Don't really need spaces
|
||||
my $macro = qr/
|
||||
\^$international
|
||||
\( ##Opening paren
|
||||
($sub_args)
|
||||
\); ##Closing paren and semicolon
|
||||
/xo;
|
||||
## Remove all macros but International, and set them to call WebGUI::Macro::Callback
|
||||
my $originalMacros = $session->config->get('macros');
|
||||
my $configFileMacros = {};
|
||||
for my $macro (keys %$originalMacros) {
|
||||
if ($originalMacros->{$macro} eq 'International') {
|
||||
$configFileMacros->{$macro} = 'Callback';
|
||||
}
|
||||
}
|
||||
$session->config->set('macros', $configFileMacros);
|
||||
|
||||
# put your tests here
|
||||
|
||||
|
|
@ -65,10 +57,8 @@ while (my $templateAsset = $getATemplate->()) {
|
|||
title => $templateAsset->getTitle,
|
||||
};
|
||||
}
|
||||
while ($template =~ /$macro/msgc) {
|
||||
my ($label, $namespace) = split /,/, $1;
|
||||
$label =~ tr/'//d;
|
||||
$namespace =~ tr/'//d;
|
||||
WebGUI::Macro::Callback::setCallback(sub {
|
||||
my ($session, $label, $namespace) = @_;
|
||||
push @templateLabels, {
|
||||
label => $label,
|
||||
namespace => $namespace,
|
||||
|
|
@ -76,7 +66,8 @@ while (my $templateAsset = $getATemplate->()) {
|
|||
id => $templateAsset->getId,
|
||||
title => $templateAsset->getTitle,
|
||||
};
|
||||
}
|
||||
});
|
||||
WebGUI::Macro::process($session, \$template);
|
||||
}
|
||||
|
||||
$numTests = scalar @templateLabels + scalar @questionableTemplates;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue