Fail if baseline longer than generated

This commit is contained in:
Ryan Brandenburg 2017-04-27 12:50:31 -07:00
parent f0d0c3d0b8
commit dc66eabbff
1 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
{
var walker = new Walker(baseline);
walker.Visit(node);
walker.AssertReachedEndOfBaseline();
}
private class Walker : RazorIRNodeWalker
@ -53,6 +54,12 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
_visitor.Depth--;
}
public void AssertReachedEndOfBaseline()
{
// Since we're walking the nodes of our generated code there's the chance that our baseline is longer.
Assert.True(_baseline.Length == _index, "Not all lines of the baseline were visited!");
}
private void AssertNodeEquals(RazorIRNode node, string expected, string actual)
{
if (string.Equals(expected, actual))