Fixes for return statement, make Evaluate function on script return value
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2019-06-12 18:45:47 +02:00
parent 3477ddd18c
commit 22149d9243
7 changed files with 31 additions and 16 deletions

View File

@@ -34,11 +34,10 @@ TEST_CASE( "Index string table", "[integration]" ) {
Script* script = Script::Create(
R"(
table = {'bla', 'test', 'foo', 'bar'}
result = table[3]
return table[3]
)");
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto variable = script->GetVariable("result");
auto variable = script->Evaluate();
REQUIRE(variable != nullptr);
REQUIRE(*variable->EvaluateString() == "foo");
delete script;
@@ -71,11 +70,10 @@ table = {
return foo
end
}
result = table["getFoo"]()
return table["getFoo"]()
)");
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto variable = script->GetVariable("result");
auto variable = script->Evaluate();
REQUIRE(variable != nullptr);
delete script;
}