Just assert doesn't throw and don't catch at LegacyDecoder

This commit is contained in:
David Zhao 2019-08-07 19:25:40 +09:00
parent da15e19912
commit 15a592e25e
3 changed files with 3 additions and 28 deletions

View File

@ -484,20 +484,14 @@ namespace osu.Game.Tests.Beatmaps.Formats
} }
[Test] [Test]
public void TestDecodeInvalidEvents() public void TestInvalidEventStillPasses()
{ {
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var goodResStream = TestResources.OpenResource("valid-events.osu"))
using (var goodStream = new StreamReader(goodResStream))
using (var badResStream = TestResources.OpenResource("invalid-events.osu")) using (var badResStream = TestResources.OpenResource("invalid-events.osu"))
using (var badStream = new StreamReader(badResStream)) using (var badStream = new StreamReader(badResStream))
{ {
var goodBeatmap = decoder.Decode(goodStream); Assert.DoesNotThrow(() => decoder.Decode(badStream));
var badBeatmap = decoder.Decode(badStream);
Assert.AreEqual(goodBeatmap.Breaks[0].Duration, badBeatmap.Breaks[0].Duration);
Assert.AreEqual(goodBeatmap.Metadata.BackgroundFile, badBeatmap.Metadata.BackgroundFile);
} }
} }
} }

View File

@ -1,12 +0,0 @@
osu file format v14
[Events]
//Background and Video events
0,0,"machinetop_background.jpg",0,0
//Break Periods
2,122474,140135
//Storyboard Layer 0 (Background)
//Storyboard Layer 1 (Fail)
//Storyboard Layer 2 (Pass)
//Storyboard Layer 3 (Foreground)
//Storyboard Sound Samples

View File

@ -43,14 +43,7 @@ namespace osu.Game.Beatmaps.Formats
continue; continue;
} }
try ParseLine(output, section, line);
{
ParseLine(output, section, line);
}
catch (Exception e)
{
Logger.Error(e, $"Failed to process line \"{line}\" into {output}");
}
} }
} }