mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Properly fix "bad cast" exceptions in tests.
The exceptions were originating from boost::locale::to_lower, when the global locale had not been set correctly.
This commit is contained in:
@@ -28,18 +28,7 @@ along with LOOT. If not, see
|
||||
#include "backend/masterlist.h"
|
||||
#include "tests/fixtures.h"
|
||||
|
||||
class Masterlist : public SkyrimTest {
|
||||
protected:
|
||||
inline virtual void SetUp() {
|
||||
SkyrimTest::SetUp();
|
||||
|
||||
// 'bad cast' exceptions are thrown for some reason unless a game is
|
||||
// initialised.
|
||||
loot::Game game(loot::Game::tes5);
|
||||
game.SetGamePath(dataPath.parent_path());
|
||||
ASSERT_NO_THROW(game.Init(false, localPath));
|
||||
}
|
||||
};
|
||||
class Masterlist : public SkyrimTest {};
|
||||
|
||||
TEST_F(Masterlist, Update_Game) {
|
||||
loot::Game game(loot::Game::tes5);
|
||||
|
||||
@@ -32,23 +32,17 @@ class MetadataList : public SkyrimTest {
|
||||
protected:
|
||||
MetadataList() :
|
||||
metadataPath("./testing-metadata-master/masterlist.yaml"),
|
||||
savedMetadataPath("./testing-metadata-master/saved.masterlist.yaml") {}
|
||||
savedMetadataPath("./testing-metadata-master/saved.masterlist.yaml") {
|
||||
PluginMetadataToString = [](const loot::PluginMetadata& plugin) {
|
||||
return plugin.Name();
|
||||
};
|
||||
}
|
||||
|
||||
inline virtual void SetUp() {
|
||||
SkyrimTest::SetUp();
|
||||
|
||||
ASSERT_TRUE(boost::filesystem::exists(metadataPath));
|
||||
ASSERT_FALSE(boost::filesystem::exists(savedMetadataPath));
|
||||
|
||||
// 'bad cast' exceptions are thrown for some reason unless a game is
|
||||
// initialised.
|
||||
loot::Game game(loot::Game::tes5);
|
||||
game.SetGamePath(dataPath.parent_path());
|
||||
ASSERT_NO_THROW(game.Init(false, localPath));
|
||||
|
||||
PluginMetadataToString = [](const loot::PluginMetadata& plugin) {
|
||||
return plugin.Name();
|
||||
};
|
||||
}
|
||||
|
||||
inline virtual void TearDown() {
|
||||
|
||||
@@ -73,6 +73,10 @@ TEST(ModuloOperator, Cpp11Conformance) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
//Set the locale to get encoding conversions working correctly.
|
||||
std::locale::global(boost::locale::generator().generate(""));
|
||||
boost::filesystem::path::imbue(std::locale());
|
||||
|
||||
//Disable logging or else stdout will get overrun.
|
||||
boost::log::core::get()->set_logging_enabled(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user