aboutsummaryrefslogtreecommitdiff
path: root/unit_tests
diff options
context:
space:
mode:
authorBenoit Germain <benoit.germain@ubisoft.com>2024-12-20 17:21:32 +0100
committerBenoit Germain <benoit.germain@ubisoft.com>2024-12-20 17:21:32 +0100
commit59ae58fd31d63c261372bd5a36765328583bc1b6 (patch)
tree44eef790bd9948d864db350746c4017a47d93e53 /unit_tests
parent30579fc3e7c73bbad5d376c43f226b2c16c7cebb (diff)
downloadlanes-59ae58fd31d63c261372bd5a36765328583bc1b6.tar.gz
lanes-59ae58fd31d63c261372bd5a36765328583bc1b6.tar.bz2
lanes-59ae58fd31d63c261372bd5a36765328583bc1b6.zip
Make VS Test Explorer happy by absorbing the text output of legacy tests
Diffstat (limited to 'unit_tests')
-rw-r--r--unit_tests/Catch2.runsettings3
-rw-r--r--unit_tests/shared.cpp12
2 files changed, 12 insertions, 3 deletions
diff --git a/unit_tests/Catch2.runsettings b/unit_tests/Catch2.runsettings
index 9360bfb..c8e32ee 100644
--- a/unit_tests/Catch2.runsettings
+++ b/unit_tests/Catch2.runsettings
@@ -22,9 +22,6 @@
22 <!-- Combine: A single test executable is started to run multiple test cases. (Single: instance per test case) --> 22 <!-- Combine: A single test executable is started to run multiple test cases. (Single: instance per test case) -->
23 <ExecutionMode>Combine</ExecutionMode> 23 <ExecutionMode>Combine</ExecutionMode>
24 24
25 <!-- In Milliseconds -->
26 <TestCaseTimeout>10000</TestCaseTimeout>
27
28 <!-- Working directory --> 25 <!-- Working directory -->
29 <WorkingDirectoryRoot>Solution</WorkingDirectoryRoot> 26 <WorkingDirectoryRoot>Solution</WorkingDirectoryRoot>
30 <WorkingDirectory>Lanes</WorkingDirectory> 27 <WorkingDirectory>Lanes</WorkingDirectory>
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();