Skip to content

Commit

Permalink
Normalize away runtime version in RoslynCodeTaskFactory generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
rainersigwald committed Nov 14, 2019
1 parent d775c0c commit c4af6d0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Tasks.UnitTests/RoslynCodeTaskFactory_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Microsoft.Build.Framework;
using Microsoft.Build.Shared;
using Microsoft.Build.UnitTests;
using Microsoft.Build.Utilities;
using Shouldly;
Expand Down Expand Up @@ -732,8 +734,16 @@ private void TryLoadTaskBodyAndExpectSuccess(

if (expectedSourceCode != null)
{
taskInfo.SourceCode.ShouldBe(expectedSourceCode, StringCompareShould.IgnoreLineEndings);
NormalizeRuntime(taskInfo.SourceCode)
.ShouldBe(NormalizeRuntime(expectedSourceCode), StringCompareShould.IgnoreLineEndings);
}
}

private static readonly Regex RuntimeVersionLine = new Regex("Runtime Version:.*");

private static string NormalizeRuntime(string input)
{
return RuntimeVersionLine.Replace(input, "Runtime Version:SOMETHING");
}
}
}

0 comments on commit c4af6d0

Please sign in to comment.