1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-29 17:15:34 +00:00

Support custom log level in tests

This commit is contained in:
elsid 2024-06-15 13:53:13 +02:00
parent 6a67263d6b
commit a5d9bb08e0
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
4 changed files with 19 additions and 4 deletions

View file

@ -458,10 +458,14 @@ CUSTOM, PLAYER: useInterface.lua
callback.call(1.5, 2.5);
EXPECT_EQ(internal::GetCapturedStdout(), "1.5\t2.5\n");
const Debug::Level level = std::exchange(Log::sMinDebugLevel, Debug::All);
testing::internal::CaptureStdout();
callback.mHiddenData[LuaUtil::ScriptsContainer::sScriptIdKey] = sol::nil;
callback.call(1.5, 2.5);
EXPECT_EQ(internal::GetCapturedStdout(), "Ignored callback to the removed script some_script.lua\n");
Log::sMinDebugLevel = level;
}
}

View file

@ -1,13 +1,16 @@
#include <gtest/gtest.h>
#include <components/debug/debugging.hpp>
#include <components/misc/strings/conversion.hpp>
#include <components/settings/parser.hpp>
#include <components/settings/values.hpp>
#include "components/misc/strings/conversion.hpp"
#include "components/settings/parser.hpp"
#include "components/settings/values.hpp"
#include <gtest/gtest.h>
#include <filesystem>
int main(int argc, char** argv)
{
Log::sMinDebugLevel = Debug::getDebugLevel();
const std::filesystem::path settingsDefaultPath = std::filesystem::path{ OPENMW_PROJECT_SOURCE_DIR } / "files"
/ Misc::StringUtils::stringToU8String("settings-default.cfg");

View file

@ -1,7 +1,11 @@
#include <components/debug/debugging.hpp>
#include <gtest/gtest.h>
int main(int argc, char* argv[])
{
Log::sMinDebugLevel = Debug::getDebugLevel();
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

View file

@ -1,7 +1,11 @@
#include <components/debug/debugging.hpp>
#include <gtest/gtest.h>
int main(int argc, char* argv[])
{
Log::sMinDebugLevel = Debug::getDebugLevel();
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}