Implements setting table values
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-06-14 17:12:27 +02:00
parent 996b5be496
commit a9def6c539
14 changed files with 141 additions and 15 deletions

View File

@@ -44,5 +44,22 @@ end
delete script;
}
TEST_CASE( "Sets UserData value", "[integration]" ) {
UserDataStorage::RegisterType(HashedString::ConstHash("testObject"), UserDataTestObject::CreateData());
Script* script = Script::Create(R"(
function testFunc(testObject obj)
obj["foo"] = 5000
end
)");
REQUIRE(!script->Diagnostics -> HasErrors());
script->Evaluate();
auto obj = new UserDataTestObject();
auto parameter = new UserDataValue(HashedString::ConstHash("testObject"), obj);
script->CallFunction("testFunc", {parameter});
REQUIRE(obj->foo == 5000);
delete script;
}
#endif