diff options
| author | Simon Wisselink <wisskid@users.noreply.github.com> | 2023-09-14 10:21:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-14 10:21:06 +0200 |
| commit | af2e12d58eda08c3b50cf03447dc5f4cdc412fff (patch) | |
| tree | d2e44ad19a24d885cb5864f3cd6834f2e6c8bf9b /tests | |
| parent | 7a58ca251792e76c6fde48d8d7e4f5b64c228bbd (diff) | |
| download | smarty-af2e12d58eda08c3b50cf03447dc5f4cdc412fff.tar.gz smarty-af2e12d58eda08c3b50cf03447dc5f4cdc412fff.tar.bz2 smarty-af2e12d58eda08c3b50cf03447dc5f4cdc412fff.zip | |
Fix use of negative numbers in math equations. (#903)
Fixes #895
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php b/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php index 8d9f07f5..4f38c161 100644 --- a/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php +++ b/tests/UnitTests/TemplateSource/ValueTests/Math/MathTest.php @@ -93,6 +93,14 @@ class MathTest extends PHPUnit_Smarty $this->assertEquals($expected, $this->smarty->fetch($tpl)); } + public function testNegativeNumbers() + { + $this->smarty->disableSecurity(); + $expected = "-19 -- 4.1"; + $tpl = $this->smarty->createTemplate('eval:{$x = 4}{$y = 5.5}{math equation="-2.0*(x+y)" x=$x y=$y} -- {math equation="-20.5 / -5"}'); + $this->assertEquals($expected, $this->smarty->fetch($tpl)); + } + public function testSyntaxFormat() { $this->smarty->disableSecurity(); |
