mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Update error message and add test case
This commit is contained in:
@@ -708,7 +708,7 @@ class GD_CORE_API ExpressionParser2 {
|
||||
if (type == "number") {
|
||||
message = _("You must enter a number or a valid expression call.");
|
||||
} else if (type == "string") {
|
||||
message = _("You must enter a text or a valid expression call.");
|
||||
message = _("You must enter a text (between quotes) or a valid expression call.");
|
||||
} else if (gd::ParameterMetadata::IsExpression("variable", type)) {
|
||||
message = _("You must enter a variable name.");
|
||||
} else if (type == "identifier") {
|
||||
|
@@ -52,8 +52,9 @@ TEST_CASE("ExpressionParser2", "[common][events]") {
|
||||
gd::ExpressionValidator validator;
|
||||
node->Visit(validator);
|
||||
REQUIRE(validator.GetErrors().size() == 1);
|
||||
REQUIRE(validator.GetErrors()[0]->GetMessage() ==
|
||||
"You must enter a text or a valid expression call.");
|
||||
REQUIRE(
|
||||
validator.GetErrors()[0]->GetMessage() ==
|
||||
"You must enter a text (between quotes) or a valid expression call.");
|
||||
}
|
||||
{
|
||||
auto node = parser.ParseExpression("string", "abcd");
|
||||
@@ -182,6 +183,17 @@ TEST_CASE("ExpressionParser2", "[common][events]") {
|
||||
"This parameter was not expected by this expression. Remove it "
|
||||
"or verify that you've entered the proper expression name.");
|
||||
}
|
||||
{
|
||||
auto node = parser.ParseExpression("string", "=\"test\"");
|
||||
REQUIRE(node != nullptr);
|
||||
|
||||
gd::ExpressionValidator validator;
|
||||
node->Visit(validator);
|
||||
REQUIRE(validator.GetErrors().size() == 1);
|
||||
REQUIRE(
|
||||
validator.GetErrors()[0]->GetMessage() ==
|
||||
"You must enter a text (between quotes) or a valid expression call.");
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("Invalid parenthesis") {
|
||||
|
Reference in New Issue
Block a user