mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Allow clean and dirty metadata in regex plugin entries
This commit is contained in:
@@ -93,13 +93,13 @@ This is the structure that brings all the others together, and forms the main co
|
||||
|
||||
``cleaning data set``
|
||||
|
||||
Cleaning data for this plugin, identifying dirty plugins. Plugin entries with regular expression filenames **must not** contain cleaning data.
|
||||
An unordered set of cleaning data structures for this plugin, identifying dirty plugins.
|
||||
|
||||
.. describe:: clean
|
||||
|
||||
``cleaning data set``
|
||||
|
||||
An unordered set of cleaning data structures for this plugin, identifying clean plugins. Plugin entries with regular expression filenames **must not** contain cleaning data. The ``itm``, ``udr`` and ``nav`` fields are unused in this context, as they're assumed to be zero.
|
||||
An unordered set of cleaning data structures for this plugin, identifying clean plugins. The ``itm``, ``udr`` and ``nav`` fields are unused in this context, as they're assumed to be zero.
|
||||
|
||||
Equality
|
||||
--------
|
||||
|
||||
@@ -119,24 +119,12 @@ struct convert<loot::PluginMetadata> {
|
||||
if (node["tag"])
|
||||
rhs.SetTags(node["tag"].as<std::set<loot::Tag>>());
|
||||
if (node["dirty"]) {
|
||||
if (rhs.IsRegexPlugin())
|
||||
throw RepresentationException(node.Mark(),
|
||||
"bad conversion: 'dirty' key must not be "
|
||||
"present in a regex 'plugin metadata' "
|
||||
"object");
|
||||
else
|
||||
rhs.SetDirtyInfo(
|
||||
node["dirty"].as<std::set<loot::PluginCleaningData>>());
|
||||
rhs.SetDirtyInfo(
|
||||
node["dirty"].as<std::set<loot::PluginCleaningData>>());
|
||||
}
|
||||
if (node["clean"]) {
|
||||
if (rhs.IsRegexPlugin())
|
||||
throw RepresentationException(node.Mark(),
|
||||
"bad conversion: 'clean' key must not be "
|
||||
"present in a regex 'plugin metadata' "
|
||||
"object");
|
||||
else
|
||||
rhs.SetCleanInfo(
|
||||
node["clean"].as<std::set<loot::PluginCleaningData>>());
|
||||
rhs.SetCleanInfo(
|
||||
node["clean"].as<std::set<loot::PluginCleaningData>>());
|
||||
}
|
||||
if (node["url"])
|
||||
rhs.SetLocations(node["url"].as<std::set<loot::Location>>());
|
||||
|
||||
@@ -959,8 +959,12 @@ TEST_P(PluginMetadataTest,
|
||||
" util: 'utility'\n"
|
||||
" udr: 1\n"
|
||||
" nav: 2");
|
||||
PluginMetadata plugin = node.as<PluginMetadata>();
|
||||
|
||||
EXPECT_THROW(node.as<PluginMetadata>(), YAML::RepresentationException);
|
||||
EXPECT_EQ("Blank\\.esp", plugin.GetName());
|
||||
EXPECT_EQ(std::set<PluginCleaningData>(
|
||||
{PluginCleaningData(5, "utility", info_, 0, 1, 2)}),
|
||||
plugin.GetDirtyInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest,
|
||||
@@ -970,8 +974,12 @@ TEST_P(PluginMetadataTest,
|
||||
"clean:\n"
|
||||
" - crc: 0x5\n"
|
||||
" util: 'utility'");
|
||||
PluginMetadata plugin = node.as<PluginMetadata>();
|
||||
|
||||
EXPECT_THROW(node.as<PluginMetadata>(), YAML::RepresentationException);
|
||||
EXPECT_EQ("Blank\\.esp", plugin.GetName());
|
||||
EXPECT_EQ(std::set<PluginCleaningData>(
|
||||
{PluginCleaningData(5, "utility")}),
|
||||
plugin.GetCleanInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, decodingFromYamlWithAnInvalidRegexNameShouldThrow) {
|
||||
|
||||
Reference in New Issue
Block a user