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

Function TEST

engine/lua/src/test/test_lua_csharp.cpp:64–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64TEST(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
96int main(int argc, char **argv)
97{

Callers

nothing calls this directly

Calls 8

luaL_newstateFunction · 0.85
luaL_openlibsFunction · 0.85
lua_gettopFunction · 0.85
lua_pushnumberFunction · 0.85
lua_setfieldFunction · 0.85
PrintTableFunction · 0.85
lua_closeFunction · 0.85
RunStringFunction · 0.70

Tested by

no test coverage detected