diff --git a/OpenRA.Game/MiniYaml.cs b/OpenRA.Game/MiniYaml.cs index efca3cff66..80b663edba 100644 --- a/OpenRA.Game/MiniYaml.cs +++ b/OpenRA.Game/MiniYaml.cs @@ -254,7 +254,7 @@ namespace OpenRA public static List FromString(string text, string fileName = "") { - 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 Merge(IEnumerable> sources) diff --git a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs index e9eb311442..6d10dafd2f 100644 --- a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs +++ b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs @@ -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); + } } }