Fix #1893 - fix formatting of RazorCompile

This commit is contained in:
Ryan Nowak 2018-01-02 08:29:12 -08:00
parent 3ae601e4df
commit 2717cf8e77
3 changed files with 42 additions and 1 deletions

View File

@ -253,7 +253,7 @@
</Csc>
<!-- Output the PDB and COPY of things to FileWrites -->
<Message Importance="High" Text="$(_RazorIntermediateAssembly) -> $(OutDir)$(RazorTargetName)" />
<Message Importance="High" Text="$(TargetName) -&gt; $([System.IO.Path]::GetFullPath('$(OutDir)$(RazorTargetName).dll'))" />
<Copy
SourceFiles="$(_RazorIntermediateAssembly)"
DestinationFolder="$(OutDir)"

View File

@ -73,6 +73,32 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
}
}
public static void BuildOutputContainsLine(MSBuildResult result, string match)
{
if (result == null)
{
throw new ArgumentNullException(nameof(result));
}
if (match == null)
{
throw new ArgumentNullException(nameof(match));
}
// We don't really need to search line by line, I'm doing this so that it's possible/easy to debug.
var lines = result.Output.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
for (var i = 0; i < lines.Length; i++)
{
var line = lines[i].Trim();
if (line == match)
{
return;
}
}
throw new BuildOutputMissingException(result, match);
}
public static void FileExists(MSBuildResult result, params string[] paths)
{
if (result == null)
@ -189,6 +215,19 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
protected override string Heading => "Build should have failed, but it passed.";
}
private class BuildOutputMissingException : MSBuildXunitException
{
public BuildOutputMissingException(MSBuildResult result, string match)
: base(result)
{
Match = match;
}
public string Match { get; }
protected override string Heading => $"Build did not contain the line: '{Match}'.";
}
private class FileMissingException : MSBuildXunitException
{
public FileMissingException(MSBuildResult result, string filePath)

View File

@ -18,6 +18,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
Assert.BuildPassed(result);
Assert.FileExists(result, OutputPath, "SimpleMvc.dll");
Assert.FileExists(result, OutputPath, "SimpleMvc.PrecompiledViews.dll");
Assert.BuildOutputContainsLine(result, $"SimpleMvc -> {Path.Combine(Path.GetFullPath(Project.DirectoryPath), OutputPath, "SimpleMvc.PrecompiledViews.dll")}");
}
[Fact]