aboutsummaryrefslogtreecommitdiff
path: root/unit_tests/shared.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unit_tests/shared.cpp')
-rw-r--r--unit_tests/shared.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/unit_tests/shared.cpp b/unit_tests/shared.cpp
index d2b4ef7..c2b8bf0 100644
--- a/unit_tests/shared.cpp
+++ b/unit_tests/shared.cpp
@@ -389,6 +389,18 @@ TEST_CASE("LuaState.doString")
389FileRunner::FileRunner(std::string_view const& where_) 389FileRunner::FileRunner(std::string_view const& where_)
390: LuaState{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ true } } 390: LuaState{ LuaState::WithBaseLibs{ true }, LuaState::WithFixture{ true } }
391{ 391{
392 // _G.print = _nullprint
393 // because the VS Test Explorer doesn't appreciate the text output of some scripts, so absorb them
394 if constexpr (1) {
395 auto const _nullprint = +[](lua_State* const L_) { return 0; };
396 luaG_pushglobaltable(L);
397 lua_pushcfunction(L, _nullprint);
398 luaG_setfield(L, StackIndex{ -2 }, std::string_view{ "print" });
399 lua_pop(L, 1);
400 stackCheck(0);
401 }
402 // TODO: do the same with io.stderr:write?
403
392 [[maybe_unused]] std::filesystem::path const _current{ std::filesystem::current_path() }; 404 [[maybe_unused]] std::filesystem::path const _current{ std::filesystem::current_path() };
393 std::filesystem::path _path{ where_ }; 405 std::filesystem::path _path{ where_ };
394 root = std::filesystem::canonical(_path).generic_string(); 406 root = std::filesystem::canonical(_path).generic_string();