Skip to content

Commit

Permalink
Add expected output tests for regex source generator (dotnet#80937)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stephentoub authored and mdh1418 committed Jan 24, 2023
1 parent 697aa73 commit 4708688
Show file tree
Hide file tree
Showing 3 changed files with 890 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Loading

0 comments on commit 4708688

Please sign in to comment.