Reworked handling of numerical key tables to make iteration over keys actual numerics, instead of strings
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-06-27 14:02:31 +02:00
parent d86e9ba8ae
commit 9727c9365e
8 changed files with 121 additions and 11 deletions

View File

@@ -63,7 +63,7 @@ end
TEST_CASE( "Generic for loop over simple numerical table, get keys", "[integration]" ) {
auto script = Script::Create(uR"(
local table = {1, 3, 5, 7, 9}
result = ""
result = 0
for i in table do
result = result + i
end
@@ -71,14 +71,14 @@ end
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto var = script->GetVariable(u"result");
REQUIRE(var->EvaluateString() == u"12345");
REQUIRE(var->EvaluateInteger() == 15);
delete script;
}
TEST_CASE( "Generic for loop over simple numerical table, get values", "[integration]" ) {
auto script = Script::Create(uR"(
local table = {1, 3, 5, 7, 9}
result = ""
result = 0
for i,v in table do
result = result + v
end
@@ -86,7 +86,7 @@ end
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto var = script->GetVariable(u"result");
REQUIRE(var->EvaluateString() == u"13579");
REQUIRE(var->EvaluateInteger() == 25);
delete script;
}