| 62 | } |
| 63 | |
| 64 | TEST(CSharp, Lua) |
| 65 | { |
| 66 | lua_State* L = luaL_newstate(); |
| 67 | luaL_openlibs(L); |
| 68 | |
| 69 | int top = lua_gettop(L); |
| 70 | ASSERT_EQ(0, top); |
| 71 | |
| 72 | // Test C |
| 73 | printf("C ->\n"); |
| 74 | lua_newtable(L); |
| 75 | lua_pushnumber(L, 1); |
| 76 | lua_setfield(L, -2, "testvalue"); |
| 77 | PrintTable(L, 1); |
| 78 | printf("<- C\n"); |
| 79 | |
| 80 | // Test C# |
| 81 | printf("C# ->\n"); |
| 82 | int result = csRunTestsLua(L); |
| 83 | ASSERT_EQ(0, result); |
| 84 | PrintTable(L, 1); |
| 85 | printf("<- C#\n"); |
| 86 | |
| 87 | // Test the C# module |
| 88 | RunString(L, "local r = csfuncs.add(1, 2); print('C# add(1, 2) ==', r); assert(r == 3)"); |
| 89 | |
| 90 | lua_pop(L, 2); // two tables |
| 91 | top = lua_gettop(L); |
| 92 | ASSERT_EQ(0, top); |
| 93 | lua_close(L); |
| 94 | } |
| 95 | |
| 96 | int main(int argc, char **argv) |
| 97 | { |
nothing calls this directly
no test coverage detected