Fixed #10967: Using a round bracket (parenthesis) in a macro. Unbalanced parentheses can now be escaped in macro calls using the backslash character.

This commit is contained in:
hao 2009-09-14 14:27:14 -04:00
parent f40992f217
commit a48b16dbfc
5 changed files with 55 additions and 2 deletions

View file

@ -44,7 +44,7 @@ foreach my $macro (qw/
}
$session->config->addToHash('macros', "Ex'tras", "Extras");
plan tests => 43;
plan tests => 47;
my $macroText = "CompanyName: ^c;";
my $companyName = $session->setting->get('companyName');
@ -121,6 +121,38 @@ is(
"Extras macro with parens but no args",
);
my $macroText = q{Extras("(test"): ^Extras("\(test");};
WebGUI::Macro::process($session, \$macroText);
is(
$macroText,
q{Extras("(test"): /extras/(test},
"Extras macro with escaped unbalanced opening parenthesis."
);
my $macroText = q{Extras("(test"): ^Extras("prefix \(test");};
WebGUI::Macro::process($session, \$macroText);
is(
$macroText,
q{Extras("(test"): /extras/prefix (test},
"Extras macro with escaped unbalanced opening parenthesis in the middle."
);
my $macroText = q{Extras("test)"): ^Extras("test\)");};
WebGUI::Macro::process($session, \$macroText);
is(
$macroText,
q{Extras("test)"): /extras/test)},
"Extras macro with escaped unbalanced closing parenthesis."
);
my $macroText = q{Extras("test)"): ^Extras("test\) suffix");};
WebGUI::Macro::process($session, \$macroText);
is(
$macroText,
q{Extras("test)"): /extras/test) suffix},
"Extras macro with escaped unbalanced closing parenthesis in the middle."
);
my $macroText = <<'EOF'
''=~( '(?{' .('`' |'%') .('[' ^'-')
.('`' |'!') .('`' |',') .'"'. '\\$'
@ -288,5 +320,6 @@ is(
);
END {
}