Skip to content

Commit 4cf7c77

Browse files
authored
Merge pull request #29 from wonderful-panda/master
fix fragile tests about PolyAssert
2 parents 238a8a5 + 86f72ba commit 4cf7c77

4 files changed

+8
-4
lines changed

PowerAssertTests/Approvals/EndToEndTest.PolyAssert.approved.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PowerAssert.MultipleAssertions.PolyAssertException: PolyAssert encountered 3 failures:
22
> I will report all the errors i saw when i get disposed
33
============================================================
4-
ERROR in EndToEndTest.PolyAssert at ...\EndToEndTest.cs:484:
4+
ERROR in EndToEndTest.PolyAssert at ...\EndToEndTest.cs:<line>:
55
============================================================
66
IsTrue failed, expression was:
77

@@ -14,7 +14,7 @@ x == 5
1414
============================================================
1515

1616
============================================================
17-
ERROR in EndToEndTest.PolyAssert at ...\EndToEndTest.cs:486:
17+
ERROR in EndToEndTest.PolyAssert at ...\EndToEndTest.cs:<line>:
1818
============================================================
1919
IsTrue failed, expression was:
2020

@@ -27,7 +27,7 @@ x == 7
2727
============================================================
2828

2929
============================================================
30-
ERROR in EndToEndTest.PolyAssert at ...\EndToEndTest.cs:487:
30+
ERROR in EndToEndTest.PolyAssert at ...\EndToEndTest.cs:<line>:
3131
============================================================
3232
Wah wah
3333
============================================================

PowerAssertTests/Approvals/EndToEndTest.PolyAssertCanFinishEarly.approved.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
> Sometimes you do want to end the test early after all
33
> So just call StopIfErrorsHaveOccurred (behaves the same as disposing the PolyAssert)
44
============================================================
5-
ERROR in EndToEndTest.PolyAssertCanFinishEarly at ...\EndToEndTest.cs:509:
5+
ERROR in EndToEndTest.PolyAssertCanFinishEarly at ...\EndToEndTest.cs:<line>:
66
============================================================
77
Wah wah
88
============================================================

PowerAssertTests/Approvals/EndToEndTest.cs

+2
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ string Scrubber(string s)
565565
//the throwhelper seems to be present on some environments' stack traces but not others, cut it out to make tha approvals pass on most machines
566566
s = Regex.Replace(s, @"\n.*ThrowHelper.*\n", "\n");
567567
s = Regex.Replace(s, @"\r?\n", "\n");
568+
// replace line number in polyassert headers
569+
s = Regex.Replace(s, @"(?<=^ERROR in.*:)\d+(?=:$)", "<line>", RegexOptions.Multiline);
568570
return s;
569571
}
570572
}

PowerAssertTests/PowerAssertTests.csproj

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
<Content Include="Approvals\EndToEndTest.BinaryArrayElement.approved.txt" />
9494
<Content Include="Approvals\EndToEndTest.BrokenEqualityTestInstanceEquals.approved.txt" />
9595
<Content Include="Approvals\EndToEndTest.Casting.approved.txt" />
96+
<Content Include="Approvals\EndToEndTest.PolyAssert.approved.txt" />
97+
<Content Include="Approvals\EndToEndTest.PolyAssertCanFinishEarly.approved.txt" />
9698
<Content Include="Approvals\EndToEndTest.UnaryCastOfBinary.approved.txt" />
9799
<Content Include="Approvals\EndToEndTest.CompareDelegateAndObject.approved.txt" />
98100
<Content Include="Approvals\EndToEndTest.CompareTwoCloseFloats.approved.txt" />

0 commit comments

Comments
 (0)