Skip to content

Commit

Permalink
Item15192: updated fix to $EVAL()
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed May 22, 2023
1 parent 6759b46 commit e3afa2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -1741,7 +1741,7 @@ sub _safeEvalPerl {
# disable glob for security reasons
$theText =~ s/^([\(\s]*)\<+/$1/g;
$theText =~ s/\>+([\s\)]*)$/$1/g;
$theText =~ s/\<\s*\>/ /g;
$theText =~ s/\<[\.\*\/\?\s]*\>/ /g;

return "" unless defined($theText);

Expand Down
Expand Up @@ -444,6 +444,12 @@ sub test_EVAL_GLOB {
$this->assert( $this->CALC('$EVAL(<>)') == 0 );
$this->assert( $this->CALC('$EVAL(2+<>+2)') == 4 );
$this->assert( $this->CALC('$EVAL(2+< >+2)') == 4 );
$this->assert( $this->CALC('$EVAL(%+.<*>.2)') =~ /^ERROR:/ );
$this->assert( $this->CALC('$EVAL(2+<e>+2)') == 4 );
$this->assert( $this->CALC('$EVAL(2+<x>+2)') == 4 );
$this->assert( $this->CALC('$EVAL(%-.<*>.2)') =~ /^ERROR:/ );
$this->assert( $this->CALC('$EVAL(%+.<../*>.2)') =~ /^ERROR:/ );
$this->assert( $this->CALC('$EVAL(3-<../*>-3)') == 6 );
}

sub test_EVEN {
Expand Down

0 comments on commit e3afa2c

Please sign in to comment.