kbilsted / StatePrinter

Automating unit testing and ToString() coding
Apache License 2.0
93 stars 32 forks source link

Problem with rewriting expected values if value contains brackets. #50

Closed addamichal closed 6 years ago

addamichal commented 7 years ago

Current version does not correctly rewrite expected value, if given value contains brackets. Example:

string expected = @"new List<Int32>()
{
    [0] = 1
    [1] = 2
    [2] = 3
    [3] = 4
}";
TestHelper.Assert().PrintEquals(expected, actual);

I created a pull request with proposed fix: https://github.com/kbilsted/StatePrinter/pull/49

kbilsted commented 7 years ago

There are similar bugs for other regex meta characters such as { and * ..

We could fix them all now... if it is ever likely such an output is ever used. I guess your PR arose from a problematic situation?

Also perhaps then all the calls to replace should be reimplemented to gain speed

kbilsted commented 6 years ago

merged PR