Skip to content
Snippets Groups Projects
Commit 20794e72 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Change string concatenation with boolean values

The value of the boolean is now concatenated using the "true" or
"false" instead of the conversion to integer (1 or 0).
parent cbaf5fbc
No related branches found
No related tags found
1 merge request!145git subrepo clone git@gitlab.com:OlMon/org-themes.git packages/org-themes
......@@ -16,11 +16,11 @@ class ConcatExpressionProcessor final : public INodeProcessor
{
if constexpr (std::is_same_v<B_DataT, std::string>) {
return a + std::get<B_DataT>(b);
} else if constexpr (std::is_arithmetic_v<B_DataT>) {
} else if constexpr ((std::is_arithmetic_v<B_DataT>)and(not std::is_same_v<B_DataT, bool>)) {
return a + std::to_string(std::get<B_DataT>(b));
} else {
std::ostringstream os;
os << a << b;
os << a << std::boolalpha << b;
return os.str();
}
}
......
......@@ -74,7 +74,8 @@ TEST_CASE("ConcatExpressionProcessor", "[language]")
SECTION("string + B")
{
CHECK_CONCAT_EXPRESSION_RESULT(R"(let s:string, s = "foo_"; s = s+true;)", "s", std::string{"foo_1"});
CHECK_CONCAT_EXPRESSION_RESULT(R"(let s:string, s = "foo_"; s = s+(2>1);)", "s", std::string{"foo_true"});
CHECK_CONCAT_EXPRESSION_RESULT(R"(let s:string, s = "foo_"; s = s+(1>2);)", "s", std::string{"foo_false"});
}
SECTION("string + R^1")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment