From dc66eabbff3840e3261c90a708fe92c7ed6ae5d4 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Thu, 27 Apr 2017 12:50:31 -0700 Subject: [PATCH] Fail if baseline longer than generated --- .../Langauge/IntegrationTests/RazorIRNodeVerifier.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeVerifier.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeVerifier.cs index 6c290bd87d..3b34bb5ecb 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeVerifier.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeVerifier.cs @@ -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))