diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-25 12:43:57 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-07-26 16:59:52 +0200 |
commit | 1bf8196856c631640659e0a70d900ed7950a5e30 (patch) | |
tree | 171288ed86de04357800485d332a71ce6f9c9a7b /test/buildtool/build_engine | |
parent | 806a141fd15f8598776a05b736eaf8d09fec5309 (diff) | |
download | justbuild-1bf8196856c631640659e0a70d900ed7950a5e30.tar.gz |
expression language: add quoting
Diffstat (limited to 'test/buildtool/build_engine')
-rw-r--r-- | test/buildtool/build_engine/expression/expression.test.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/buildtool/build_engine/expression/expression.test.cpp b/test/buildtool/build_engine/expression/expression.test.cpp index 8dd0aa92..888e7216 100644 --- a/test/buildtool/build_engine/expression/expression.test.cpp +++ b/test/buildtool/build_engine/expression/expression.test.cpp @@ -389,6 +389,22 @@ TEST_CASE("Expression Evaluation", "[expression]") { // NOLINT CHECK(overwrite == Expression::FromJson(R"(["bar"])"_json)); } + SECTION("quote expression") { + auto expr = Expression::FromJson(R"( + {"type": "'", "$1": {"type": "var", "name": "this is literal"}} + )"_json); + REQUIRE(expr); + + auto result = expr.Evaluate(env, fcts); + CHECK(result == Expression::FromJson(R"( + {"type": "var", "name": "this is literal"})"_json)); + + auto expr_empty = Expression::FromJson(R"({"type": "'"})"_json); + REQUIRE(expr_empty); + auto result_empty = expr_empty.Evaluate(env, fcts); + CHECK(result_empty == Expression::FromJson(R"(null)"_json)); + } + SECTION("if expression") { auto expr = Expression::FromJson(R"( { "type": "if" |