mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 13:09:42 +00:00
Fix components_tests
This commit is contained in:
parent
4529af9b7f
commit
032d506aa7
2 changed files with 12 additions and 12 deletions
|
@ -14,8 +14,8 @@ namespace
|
|||
void SetUp() override
|
||||
{
|
||||
mLua.protectedCall([&](LuaUtil::LuaView& view) {
|
||||
view.sol()["callback"] = [&](sol::protected_function fn) -> LuaUtil::Callback {
|
||||
sol::table hiddenData(view.sol(), sol::create);
|
||||
view.sol()["callback"] = [](sol::this_state state, sol::protected_function fn) -> LuaUtil::Callback {
|
||||
sol::table hiddenData(state, sol::create);
|
||||
hiddenData[LuaUtil::ScriptsContainer::sScriptIdKey] = LuaUtil::ScriptId{};
|
||||
return LuaUtil::Callback{ std::move(fn), hiddenData };
|
||||
};
|
||||
|
@ -32,11 +32,11 @@ namespace
|
|||
internal::CaptureStdout();
|
||||
mLua.protectedCall([&](LuaUtil::LuaView& view) {
|
||||
view.sol().safe_script(R"X(
|
||||
local s = 'test'
|
||||
coroutine.wrap(function()
|
||||
pass(callback(function(v) print(s) end))
|
||||
end)()
|
||||
)X");
|
||||
local s = 'test'
|
||||
coroutine.wrap(function()
|
||||
pass(callback(function(v) print(s) end))
|
||||
end)()
|
||||
)X");
|
||||
view.sol().collect_garbage();
|
||||
mCb.call();
|
||||
});
|
||||
|
@ -47,10 +47,10 @@ namespace
|
|||
{
|
||||
mLua.protectedCall([&](LuaUtil::LuaView& view) {
|
||||
view.sol().safe_script(R"X(
|
||||
coroutine.wrap(function()
|
||||
pass(callback(function() error('COROUTINE CALLBACK') end))
|
||||
end)()
|
||||
)X");
|
||||
coroutine.wrap(function()
|
||||
pass(callback(function() error('COROUTINE CALLBACK') end))
|
||||
end)()
|
||||
)X");
|
||||
view.sol().collect_garbage();
|
||||
});
|
||||
EXPECT_ERROR(mCb.call(), "COROUTINE CALLBACK");
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace LuaUtil
|
|||
bool ok = false;
|
||||
mLua.protectedCall([&](LuaView& view) {
|
||||
std::optional<sol::function> onInit, onLoad;
|
||||
bool ok = addScript(view, scriptId, onInit, onLoad);
|
||||
ok = addScript(view, scriptId, onInit, onLoad);
|
||||
if (ok && onInit)
|
||||
callOnInit(view, scriptId, *onInit, initData);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue