13 #include <luabind/luabind.hpp>
15 bool dostring(lua_State
* L
, const char* str
)
17 if (luaL_loadbuffer(L
, str
, std::strlen(str
), str
) || lua_pcall(L
, 0, 0, 0))
19 const char* a
= lua_tostring(L
, -1);
20 std::cout
<< a
<< "\n";
27 int dostring2(lua_State
* L
, const char* str
)
29 if (luaL_loadbuffer(L
, str
, std::strlen(str
), str
) || lua_pcall(L
, 0, 0, 0))
36 bool report_success(bool result
, const char* name
)
40 if (result
) std::cout
<< ": passed\n";
41 else std::cout
<< ": failed\n";
43 if (result
) std::cout
<< ": \033[32mpassed\033[0m\n";
44 else std::cout
<< ": \033[31mfailed\033[0m\n";
53 passed
&= report_success(test_construction(), "construction");
54 passed
&= report_success(test_attributes(), "attributes");
55 passed
&= report_success(test_operators(), "operators");
56 passed
&= report_success(test_implicit_cast(), "implicit cast");
57 passed
&= report_success(test_const(), "const");
58 passed
&= report_success(test_exceptions(), "exceptions");
59 passed
&= report_success(test_null_pointer(), "null pointer");
60 passed
&= report_success(test_policies(), "policies");
61 passed
&= report_success(test_lua_classes(), "lua classes");
62 passed
&= report_success(test_free_functions(), "free functions");
63 passed
&= report_success(test_object(), "object");
64 passed
&= report_success(test_held_type(), "held type");
66 if (passed
) std::cout
<< "\n\nall tests passed\n";
67 else std::cout
<< "\n\nsome tests failed\n";