Merge pull request #11464 from Phrohdoh/miniyaml-dont-strip-empty-lines
Do not remove empty entries in MiniYaml.FromString
This commit is contained in:
@@ -254,7 +254,7 @@ namespace OpenRA
|
||||
|
||||
public static List<MiniYamlNode> FromString(string text, string fileName = "<no filename available>")
|
||||
{
|
||||
return FromLines(text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries), fileName);
|
||||
return FromLines(text.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None), fileName);
|
||||
}
|
||||
|
||||
public static List<MiniYamlNode> Merge(IEnumerable<List<MiniYamlNode>> sources)
|
||||
|
||||
@@ -154,5 +154,20 @@ Test:
|
||||
Assert.IsFalse(result.First(n => n.Key == "MockString").Value.Nodes.Any(n => n.Key == "AString"),
|
||||
"MockString value should have been removed, but was not.");
|
||||
}
|
||||
|
||||
[TestCase(TestName = "Empty lines should count toward line numbers")]
|
||||
public void EmptyLinesShouldCountTowardLineNumbers()
|
||||
{
|
||||
var yaml = @"
|
||||
TestA:
|
||||
Nothing:
|
||||
|
||||
TestB:
|
||||
Nothing:
|
||||
";
|
||||
|
||||
var result = MiniYaml.FromString(yaml).First(n => n.Key == "TestB");
|
||||
Assert.AreEqual(5, result.Location.Line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user