| 29 | }; |
| 30 | |
| 31 | TEST_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 | |
| 70 | extern "C" void dmExportedSymbols(); |
| 71 |
nothing calls this directly
no test coverage detected