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 WebGUI::Session;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use WebGUI::Asset::Template;
|
use WebGUI::Asset::Template;
|
||||||
|
use WebGUI::Macro::Callback;
|
||||||
|
|
||||||
#The goal of this test is to locate all of the international labels that it
|
#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
|
#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 $session = WebGUI::Test->session;
|
||||||
my $lib = WebGUI::Test->lib;
|
my $lib = WebGUI::Test->lib;
|
||||||
|
|
||||||
##Find the name of the International macro in the user's config file.
|
## Remove all macros but International, and set them to call WebGUI::Macro::Callback
|
||||||
my $configFileMacros = $session->config->get('macros');
|
my $originalMacros = $session->config->get('macros');
|
||||||
my %macroNameLookup = reverse %{ $configFileMacros };
|
my $configFileMacros = {};
|
||||||
my $international;
|
for my $macro (keys %$originalMacros) {
|
||||||
$international = (exists $macroNameLookup{'International'}) ? $macroNameLookup{'International'} : 'International';
|
if ($originalMacros->{$macro} eq 'International') {
|
||||||
|
$configFileMacros->{$macro} = 'Callback';
|
||||||
#diag "International macro name = $international";
|
}
|
||||||
|
}
|
||||||
##Regexp setup for parsing out the Macro calls.
|
$session->config->set('macros', $configFileMacros);
|
||||||
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;
|
|
||||||
|
|
||||||
# put your tests here
|
# put your tests here
|
||||||
|
|
||||||
|
|
@ -65,10 +57,8 @@ while (my $templateAsset = $getATemplate->()) {
|
||||||
title => $templateAsset->getTitle,
|
title => $templateAsset->getTitle,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
while ($template =~ /$macro/msgc) {
|
WebGUI::Macro::Callback::setCallback(sub {
|
||||||
my ($label, $namespace) = split /,/, $1;
|
my ($session, $label, $namespace) = @_;
|
||||||
$label =~ tr/'//d;
|
|
||||||
$namespace =~ tr/'//d;
|
|
||||||
push @templateLabels, {
|
push @templateLabels, {
|
||||||
label => $label,
|
label => $label,
|
||||||
namespace => $namespace,
|
namespace => $namespace,
|
||||||
|
|
@ -76,7 +66,8 @@ while (my $templateAsset = $getATemplate->()) {
|
||||||
id => $templateAsset->getId,
|
id => $templateAsset->getId,
|
||||||
title => $templateAsset->getTitle,
|
title => $templateAsset->getTitle,
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
WebGUI::Macro::process($session, \$template);
|
||||||
}
|
}
|
||||||
|
|
||||||
$numTests = scalar @templateLabels + scalar @questionableTemplates;
|
$numTests = scalar @templateLabels + scalar @questionableTemplates;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue