Fix of SPE-1630 crash when referencing an invalid variable name

using the old placeholder parser syntax.
Also implemented unescaping of \r\n\"\\ in string syntax.
This commit is contained in:
Vojtech Bubnik 2023-04-06 10:40:07 +02:00
parent b1081d7ac3
commit 030cfaf4b3
2 changed files with 52 additions and 4 deletions

View file

@ -44,6 +44,8 @@ SCENARIO("Placeholder parser scripting", "[PlaceholderParser]") {
SECTION("multiple expressions with semicolons 2") { REQUIRE(parser.process("{temperature[foo];;temperature[foo];}") == "357357"); }
SECTION("multiple expressions with semicolons 3") { REQUIRE(parser.process("{temperature[foo];;;temperature[foo];;}") == "357357"); }
SECTION("parsing string with escaped characters") { REQUIRE(parser.process("{\"hu\\nha\\\\\\\"ha\\\"\"}") == "hu\nha\\\"ha\""); }
// Test the math expressions.
SECTION("math: 2*3") { REQUIRE(parser.process("{2*3}") == "6"); }
SECTION("math: 2*3/6") { REQUIRE(parser.process("{2*3/6}") == "1"); }