1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix issues detected by Sonar

This commit is contained in:
Ivan Savenko
2025-05-05 16:05:59 +03:00
parent cb5295b9ec
commit 4b30336d03
37 changed files with 94 additions and 114 deletions

View File

@@ -40,11 +40,11 @@ void ScriptFixture::loadScript(const JsonNode & scriptConfig)
EXPECT_CALL(*pool, getContext(Eq(subject.get()))).WillRepeatedly(Return(context));
}
void ScriptFixture::loadScript(ModulePtr module, const std::string & scriptSource)
void ScriptFixture::loadScript(ModulePtr modulePtr, const std::string & scriptSource)
{
subject = std::make_shared<ScriptImpl>(LIBRARY->scriptHandler.get());
subject->host = module;
subject->host = modulePtr;
subject->sourceText = scriptSource;
subject->identifier = "test";
subject->compile(&loggerMock);
@@ -54,11 +54,11 @@ void ScriptFixture::loadScript(ModulePtr module, const std::string & scriptSourc
EXPECT_CALL(*pool, getContext(Eq(subject.get()))).WillRepeatedly(Return(context));
}
void ScriptFixture::loadScript(ModulePtr module, const std::vector<std::string> & scriptSource)
void ScriptFixture::loadScript(ModulePtr modulePtr, const std::vector<std::string> & scriptSource)
{
std::string source = boost::algorithm::join(scriptSource, "\n");
loadScript(module, source);
loadScript(modulePtr, source);
}
void ScriptFixture::setUp()
@@ -83,9 +83,9 @@ JsonNode ScriptFixture::runServer(const JsonNode & scriptState)
return context->saveState();
}
JsonNode ScriptFixture::runScript(ModulePtr module, const std::string & scriptSource, const JsonNode & scriptState)
JsonNode ScriptFixture::runScript(ModulePtr modulePtr, const std::string & scriptSource, const JsonNode & scriptState)
{
loadScript(module, scriptSource);
loadScript(modulePtr, scriptSource);
return runClientServer(scriptState);
}

View File

@@ -65,13 +65,13 @@ public:
void loadScriptFromFile(const std::string & path);
void loadScript(const JsonNode & scriptConfig);
void loadScript(ModulePtr module, const std::string & scriptSource);
void loadScript(ModulePtr module, const std::vector<std::string> & scriptSource);
void loadScript(ModulePtr modulePtr, const std::string & scriptSource);
void loadScript(ModulePtr modulePtr, const std::vector<std::string> & scriptSource);
JsonNode runClientServer(const JsonNode & scriptState = JsonNode());
JsonNode runServer(const JsonNode & scriptState = JsonNode());
JsonNode runScript(ModulePtr module, const std::string & scriptSource, const JsonNode & scriptState = JsonNode());
JsonNode runScript(ModulePtr modulePtr, const std::string & scriptSource, const JsonNode & scriptState = JsonNode());
protected:
void setUp();