未验证 提交 0ca36476 编写于 作者: S Stephen Toub 提交者: GitHub

Add expected output tests for regex source generator (#80937)

* Add expected output tests for regex

In particular to help avoid significant formatting / readability regressions in the code output by the regex generator.

* Address PR feedback to normalize version
上级 d86c64a0
......@@ -504,9 +504,21 @@ public static void AtLeastOneEquals<T>(T expected1, T expected2, T value)
/// </summary>
public static void Equal(string expected, string actual)
{
if (!expected.Equals(actual))
try
{
throw new AssertActualExpectedException(expected, actual, "Provided strings were not equal!");
Assert.Equal(expected, actual);
}
catch (Exception e)
{
throw new XunitException(
e.Message + Environment.NewLine +
Environment.NewLine +
"Expected:" + Environment.NewLine +
expected + Environment.NewLine +
Environment.NewLine +
"Actual:" + Environment.NewLine +
actual + Environment.NewLine +
Environment.NewLine);
}
}
......
......@@ -65,6 +65,7 @@
<Compile Include="PrecompiledRegexScenarioTest.cs" />
<Compile Include="RegexCompilationInfoTests.cs" />
<Compile Include="GeneratedRegexAttributeTests.cs" />
<Compile Include="RegexGeneratorOutputTests.cs" />
<Compile Include="RegexGeneratorParserTests.cs" />
<Compile Include="RegexGroupNameTests.cs" />
<Compile Include="RegexExperiment.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册