Enforce a consistent output order when saving a MetadataList

This commit is contained in:
Oliver Hamlet
2017-09-15 17:19:47 +01:00
parent 6f17df962f
commit 4166afb6ae
2 changed files with 10 additions and 6 deletions
+4
View File
@@ -80,6 +80,10 @@ void MetadataList::Save(const boost::filesystem::path& filepath) const {
emitter << YAML::Key << "globals" << YAML::Value << messages_;
auto plugins = Plugins();
plugins.sort([](const PluginMetadata& p1, const PluginMetadata& p2) {
return p1.GetLowercasedName() < p2.GetLowercasedName();
});
if (!plugins.empty())
emitter << YAML::Key << "plugins" << YAML::Value << plugins;
@@ -74,16 +74,16 @@ protected:
std::stringstream expectedContent;
expectedContent
<< "plugins:" << endl
<< " - name: '" << blankEsm << "'" << endl
<< " tag:" << endl
<< " - Actors.ACBS" << endl
<< " - Actors.AIData" << endl
<< " - -C.Water" << endl
<< " - name: '" << blankDifferentEsm << "'" << endl
<< " dirty:" << endl
<< " - crc: 0x7d22f9df" << endl
<< " util: 'TES4Edit'" << endl
<< " udr: 4";
<< " udr: 4" << endl
<< " - name: '" << blankEsm << "'" << endl
<< " tag:" << endl
<< " - Actors.ACBS" << endl
<< " - Actors.AIData" << endl
<< " - -C.Water";
return expectedContent.str();
}