Fix travis

We were missing the newline normalization from the test base class.
This commit is contained in:
Ryan Nowak 2017-04-06 11:20:10 -07:00
parent 0cb7ae7fbf
commit 0481cc6569
6 changed files with 16 additions and 51 deletions

View File

@ -1573,47 +1573,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
} }
#endregion #endregion
protected override RazorCodeDocument CreateCodeDocument()
{
if (Filename == null)
{
var message = $"{nameof(CreateCodeDocument)} should only be called from an integration test ({nameof(Filename)} is null).";
throw new InvalidOperationException(message);
}
var normalizedFileName = Filename.Substring(0, Filename.LastIndexOf("_"));
var sourceFilename = Path.ChangeExtension(normalizedFileName, ".cshtml");
var testFile = TestFile.Create(sourceFilename);
if (!testFile.Exists())
{
throw new XunitException($"The resource {sourceFilename} was not found.");
}
var imports = new List<RazorSourceDocument>();
while (true)
{
var importsFilename = Path.ChangeExtension(normalizedFileName + "_Imports" + imports.Count.ToString(), ".cshtml");
if (!TestFile.Create(importsFilename).Exists())
{
break;
}
imports.Add(
TestRazorSourceDocument.CreateResource(importsFilename, encoding: null, normalizeNewLines: true));
}
var codeDocument = RazorCodeDocument.Create(
TestRazorSourceDocument.CreateResource(sourceFilename, encoding: null, normalizeNewLines: true), imports);
// This will ensure that we're not putting any randomly generated data in a baseline.
codeDocument.Items[DefaultRazorCSharpLoweringPhase.SuppressUniqueIds] = "test";
// This is to make tests work cross platform.
codeDocument.Items[DefaultRazorCSharpLoweringPhase.NewLineString] = "\r\n";
return codeDocument;
}
private void RunRuntimeTagHelpersTest(IEnumerable<TagHelperDescriptor> descriptors, string tagHelperPrefix = null) private void RunRuntimeTagHelpersTest(IEnumerable<TagHelperDescriptor> descriptors, string tagHelperPrefix = null)
{ {
// Arrange // Arrange

View File

@ -60,7 +60,9 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
throw new InvalidOperationException(message); throw new InvalidOperationException(message);
} }
var sourceFilename = Path.ChangeExtension(Filename, ".cshtml"); var suffixIndex = Filename.LastIndexOf("_");
var normalizedFileName = suffixIndex == -1 ? Filename : Filename.Substring(0, suffixIndex);
var sourceFilename = Path.ChangeExtension(normalizedFileName, ".cshtml");
var testFile = TestFile.Create(sourceFilename); var testFile = TestFile.Create(sourceFilename);
if (!testFile.Exists()) if (!testFile.Exists())
{ {
@ -70,7 +72,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
var imports = new List<RazorSourceDocument>(); var imports = new List<RazorSourceDocument>();
while (true) while (true)
{ {
var importsFilename = Path.ChangeExtension(Filename + "_Imports" + imports.Count.ToString(), ".cshtml"); var importsFilename = Path.ChangeExtension(normalizedFileName + "_Imports" + imports.Count.ToString(), ".cshtml");
if (!TestFile.Create(importsFilename).Exists()) if (!TestFile.Create(importsFilename).Exists())
{ {
break; break;
@ -85,6 +87,10 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
// This will ensure that we're not putting any randomly generated data in a baseline. // This will ensure that we're not putting any randomly generated data in a baseline.
codeDocument.Items[DefaultRazorCSharpLoweringPhase.SuppressUniqueIds] = "test"; codeDocument.Items[DefaultRazorCSharpLoweringPhase.SuppressUniqueIds] = "test";
// This is to make tests work cross platform.
codeDocument.Items[DefaultRazorCSharpLoweringPhase.NewLineString] = "\r\n";
return codeDocument; return codeDocument;
} }

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
#pragma warning disable 219 #pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() { private void __RazorDirectiveTokenHelpers__() {
((System.Action)(() => { ((System.Action)(() => {
global::System.Object __typeHelper = nameof(Sytem.Globalization); global::System.Object __typeHelper = nameof(System.Globalization);
} }
))(); ))();
} }

View File

@ -1 +1 @@
@custom Sytem.Globalization @custom System.Globalization

View File

@ -9,7 +9,7 @@ Document -
RazorIRToken - - CSharp - #pragma warning disable 219 RazorIRToken - - CSharp - #pragma warning disable 219
CSharpStatement - CSharpStatement -
RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() {
DirectiveToken - (8:0,8 [19] NamespaceToken.cshtml) - Sytem.Globalization DirectiveToken - (8:0,8 [20] NamespaceToken.cshtml) - System.Globalization
CSharpStatement - CSharpStatement -
RazorIRToken - - CSharp - } RazorIRToken - - CSharp - }
CSharpStatement - CSharpStatement -

View File

@ -1,5 +1,5 @@
Source Location: (8:0,8 [19] TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.cshtml) Source Location: (8:0,8 [20] TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.cshtml)
|Sytem.Globalization| |System.Globalization|
Generated Location: (413:10,44 [19] ) Generated Location: (413:10,44 [20] )
|Sytem.Globalization| |System.Globalization|