Merge pull request #6984 from DeadlySurprise/yamlFix

Fixed yaml bug with leading spaces
This commit is contained in:
Oliver Brakmann
2015-01-20 21:42:22 +01:00
5 changed files with 88 additions and 15 deletions

View File

@@ -26,12 +26,40 @@ namespace OpenRA.Test
FromParent:
FromParentRemove:
";
readonly string yamlForChild = @"
Child:
Inherits: ^Parent
FromChild:
-FromParentRemove:
";
readonly string yamlTabStyle = @"
Root1:
Child1:
Attribute1: Test
Attribute2: Test
Child2:
Attribute1: Test
Attribute2: Test
Root2:
Child1:
Attribute1: Test
";
readonly string yamlMixedStyle = @"
Root1:
Child1:
Attribute1: Test
Attribute2: Test
Child2:
Attribute1: Test
Attribute2: Test
Root2:
Child1:
Attribute1: Test
";
List<MiniYamlNode> parentList;
List<MiniYamlNode> childList;
MiniYaml parent;
@@ -85,5 +113,15 @@ Child:
Assert.That(res.Key, Is.EqualTo("Child"));
InheritanceTest(res.Value.Nodes);
}
[TestCase(TestName = "Mixed tabs & spaces indents")]
public void TestIndents()
{
var tabs = MiniYaml.FromString(yamlTabStyle, "yamlTabStyle").WriteToString();
Console.WriteLine(tabs);
var mixed = MiniYaml.FromString(yamlMixedStyle, "yamlMixedStyle").WriteToString();
Console.WriteLine(mixed);
Assert.That(tabs, Is.EqualTo(mixed));
}
}
}