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

Function TEST_F

engine/script/src/test/test_script_luasocket.cpp:31–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29};
30
31TEST_F(ScriptLuasocketTest, TestLuasocket)
32{
33 int top = lua_gettop(L);
34
35 ASSERT_TRUE(RunFile(L, "test_luasocket.luac"));
36
37#if defined(__EMSCRIPTEN__)
38 const char *funcs[] = {
39 "test_html5_minimal", 0
40 };
41#else
42 const char *funcs[] = {
43 "test_bind", "test_getaddr",
44 "test_udp", "test_tcp_clientserver",
45 "test_udp_clientserver", "test_bind_error", 0
46 };
47#endif
48
49 for (int i=0;funcs[i];i++)
50 {
51 lua_getglobal(L, "functions");
52 ASSERT_EQ(LUA_TTABLE, lua_type(L, -1));
53 lua_getfield(L, -1, funcs[i]);
54 ASSERT_EQ(LUA_TFUNCTION, lua_type(L, -1));
55 int result = dmScript::PCall(L, 0, LUA_MULTRET);
56 if (result == LUA_ERRRUN)
57 {
58 ASSERT_TRUE(false);
59 }
60 else
61 {
62 ASSERT_EQ(0, result);
63 }
64 lua_pop(L, 1);
65 }
66
67 ASSERT_EQ(top, lua_gettop(L));
68}
69
70extern "C" void dmExportedSymbols();
71

Callers

nothing calls this directly

Calls 5

lua_gettopFunction · 0.85
lua_typeFunction · 0.85
lua_getfieldFunction · 0.85
PCallFunction · 0.85
RunFileFunction · 0.70

Tested by

no test coverage detected