Utilities for tests of the lua modules. More...
Go to the source code of this file.
Classes | |
class | anonymous_namespace{test_utils.hpp}::stack_balance_checker |
Ensures that the Lua stack maintains its original height upon exit. More... |
Namespaces | |
namespace | anonymous_namespace{test_utils.hpp} |
Macros | |
#define | REQUIRE_API_ERROR(exp_api_function, statement) |
Checks that a given expression raises a particular lutok::api_error. |
Functions | |
static lua_State * | anonymous_namespace{test_utils.hpp}::raw (lutok::state &state) |
Gets the pointer to the internal lua_State of a state object. |
Utilities for tests of the lua modules.
This file is intended to be included once, and only once, for every test program that needs it. All the code is herein contained to simplify the dependency chain in the build rules.
#define REQUIRE_API_ERROR | ( | exp_api_function, | |
statement | |||
) |
Checks that a given expression raises a particular lutok::api_error.
We cannot make any assumptions regarding the error text provided by Lua, so we resort to checking only which API function raised the error (because our code is the one hardcoding these strings).
exp_api_function | The name of the Lua C API function that causes the error. |
statement | The statement to execute. |