Add tests for FieldLoader and FieldSaver

Test coverage for these classes will help prevent regressions. Major breaking changes are avoided since config files may already rely on various aspects of the behaviour, but some small breaking changes are made:

- Use `value.Split(Comma, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)` consistently for all comma-separated parsing.
- Rename LoadField to LoadFieldOrProperty for clarity - since this is the one method that cares about properties in a class otherwise focused only on fields.
- Use TryParse instead of Parse and ensure to call InvalidValueAction from all parsers so we throw the intended exception when badly formatted data is encountered.
- BooleanExpression/IntegerExpression exception message updated to align with the generic one.
- Remove FromYamlKey, and update the only user SkirmishLogic to perform this logic manually instead.
- Remove unused includePrivateByDefault parameter on GetTypeLoadInfo.
- Remove unused AllowEmptyEntriesAttribute.
This commit is contained in:
RoosterDragon
2025-11-15 12:03:39 +00:00
committed by Gustas Kažukauskas
parent 7d0340ad41
commit bc1a901f54
13 changed files with 1198 additions and 200 deletions

View File

@@ -111,7 +111,7 @@ namespace OpenRA
else if (type == Type.MiniYaml)
field.SetValue(map, node.Value);
else
FieldLoader.LoadField(map, fieldName, node.Value.Value);
FieldLoader.LoadFieldOrProperty(map, fieldName, node.Value.Value);
}
if (property != null)
@@ -121,7 +121,7 @@ namespace OpenRA
else if (type == Type.MiniYaml)
property.SetValue(map, node.Value, null);
else
FieldLoader.LoadField(map, fieldName, node.Value.Value);
FieldLoader.LoadFieldOrProperty(map, fieldName, node.Value.Value);
}
}