MCPcopy Create free account
hub / github.com/defold/defold / SetUp

Method SetUp

engine/script/src/test/test_script_msg.cpp:56–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54{
55protected:
56 void SetUp() override
57 {
58 dmScript::ContextParams script_context_params = {};
59 m_ScriptContext = dmScript::NewContext(script_context_params);
60 dmScript::Initialize(m_ScriptContext);
61 L = dmScript::GetLuaState(m_ScriptContext);
62
63 assert(dmMessage::NewSocket("default_socket", &m_DefaultURL.m_Socket) == dmMessage::RESULT_OK);
64 m_DefaultURL.m_Path = dmHashString64("default_path");
65 m_DefaultURL.m_Fragment = dmHashString64("default_fragment");
66 dmScript::PushURL(L, m_DefaultURL);
67 lua_setglobal(L, DEFAULT_URL);
68
69 int top = lua_gettop(L);
70 (void)top;
71 uint32_t* user_data = (uint32_t*)lua_newuserdata(L, 4);
72 *user_data = 1;
73 luaL_newmetatable(L, "ScriptMsgTest");
74 luaL_register(L, 0, META_TABLE);
75 lua_setmetatable(L, -2);
76 dmScript::SetInstance(L);
77 assert(top == lua_gettop(L));
78 }
79
80 void TearDown() override
81 {

Callers

nothing calls this directly

Calls 11

NewSocketFunction · 0.85
PushURLFunction · 0.85
lua_gettopFunction · 0.85
lua_newuserdataFunction · 0.85
luaL_newmetatableFunction · 0.85
lua_setmetatableFunction · 0.85
SetInstanceFunction · 0.85
NewContextFunction · 0.50
InitializeFunction · 0.50
GetLuaStateFunction · 0.50
assertFunction · 0.50

Tested by

no test coverage detected