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
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)
{
// Arrange

View File

@ -60,7 +60,9 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
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);
if (!testFile.Exists())
{
@ -70,12 +72,12 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests
var imports = new List<RazorSourceDocument>();
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())
{
break;
}
imports.Add(
TestRazorSourceDocument.CreateResource(importsFilename, encoding: null, normalizeNewLines: true));
}
@ -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.
codeDocument.Items[DefaultRazorCSharpLoweringPhase.SuppressUniqueIds] = "test";
// This is to make tests work cross platform.
codeDocument.Items[DefaultRazorCSharpLoweringPhase.NewLineString] = "\r\n";
return codeDocument;
}

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Razor.Evolution.IntegrationTests.TestFiles
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
((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
CSharpStatement -
RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() {
DirectiveToken - (8:0,8 [19] NamespaceToken.cshtml) - Sytem.Globalization
DirectiveToken - (8:0,8 [20] NamespaceToken.cshtml) - System.Globalization
CSharpStatement -
RazorIRToken - - CSharp - }
CSharpStatement -

View File

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