add a few additional macro tests

This commit is contained in:
Graham Knop 2009-08-20 19:24:39 +00:00
parent 4984e19d68
commit ac9be28857
2 changed files with 7 additions and 4 deletions

View file

@ -162,7 +162,7 @@ sub _processMacro {
$parameters =~ s/\)$//;
my @params;
while ($parameters =~ /
while ($parameters =~ m{
(?<!\z) # don't try to match if we are at the end of the string
(?: # either
\s* " # white space followed by a double quote
@ -188,9 +188,9 @@ sub _processMacro {
| # or
, # a comma
)
/xg) {
}xg) {
# three matches, only one will exist per run
push @params, defined $1 ? $1 : defined $2 ? $2 : $3;
push @params, $+;
}
for my $param (@params) {

View file

@ -44,7 +44,7 @@ foreach my $macro (qw/
}
$session->config->addToHash('macros', "Ex'tras", "Extras");
plan tests => 39;
plan tests => 42;
my $macroText = "CompanyName: ^c;";
my $companyName = $session->setting->get('companyName');
@ -236,6 +236,9 @@ tie my %quotingEdges, 'Tie::IxHash';
=> '@MacroCall[`@MacroCall[`something`.`something else`]:`.`more still`]:',
q{^VisualMacro("^VisualMacro('something', 'something else');", "more still");}
=> '@MacroCall[`@MacroCall[`something`.`something else`]:`.`more still`]:',
'^VisualMacro(,,);' => '@MacroCall[``.``]:',
'^VisualMacro("","",);' => '@MacroCall[``.``]:',
'^VisualMacro(,,"");' => '@MacroCall[``.``.``]:',
);
while (my ($inText, $outText) = each %quotingEdges) {
my $procText = $inText;