mirror of https://github.com/ppy/osu
Fix skin parser not stripping whitespace before parsing
This commit is contained in:
parent
822d469b2c
commit
bb3c3f302a
|
@ -0,0 +1,2 @@
|
|||
[General]
|
||||
Version: 2
|
|
@ -91,6 +91,15 @@ public void TestDecodeSpecifiedVersion()
|
|||
Assert.AreEqual(2.0m, decoder.Decode(stream).LegacyVersion);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStripWhitespace()
|
||||
{
|
||||
var decoder = new LegacySkinDecoder();
|
||||
using (var resStream = TestResources.OpenResource("skin-with-space.ini"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
Assert.AreEqual(2.0m, decoder.Decode(stream).LegacyVersion);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecodeLatestVersion()
|
||||
{
|
||||
|
|
|
@ -36,6 +36,8 @@ protected override void ParseStreamInto(LineBufferedReader stream, T output)
|
|||
if (ShouldSkipLine(line))
|
||||
continue;
|
||||
|
||||
line = line.Trim();
|
||||
|
||||
if (line.StartsWith('[') && line.EndsWith(']'))
|
||||
{
|
||||
if (!Enum.TryParse(line[1..^1], out section))
|
||||
|
|
Loading…
Reference in New Issue