Tests with pattern
$CreatedLongString | Should Be $ExpectedLongString
The error message is cumbersome to read (text is too long and spreads multiply lines).
So sometimes I'm trying to split it with `n and then compare each line.
For example in platyPS
But then I need to carry around the line number and display it somehow additionaly.
It's becoming hairy pretty fast.
We can take the same approach as xUnit: show a short snippet from the place in the stirng, where it's different (like 32 chars) with additional offset for the beginning of the snippet.
I think this should be relatively simple to add to the code that prints Should -Be output of strings. There is arrow that points to the difference, so the output needs to be shortened around that. We should either detect how wide the window is, or (probably better) set some maximum length for the output.
@vors Do I understand it correctly that this:
Expected strings to be the same, but they were different.
Expected length: 107
Actual length: 120
Strings differ at index 64.
Expected: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
But was: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
---------------------------------------------------------------------------^
Would become this:
Expected strings to be the same, but they were different.
Expected length: 107
Actual length: 120
Strings differ at index 64.
Expected: 'aaaa...aaaaaaaaabbbbbbbbbb...bbbb'
But was: 'aaaa...aaaaaaaaabbbbbbbbbb....bbbb'
---------------...------------^
The problem is better illustrated by this example. Notice how the wrapping is hard to follow
It 'long string' {
$a = ('a' * 1300) + ('b' * 1200)
$b = ('a' * 1301) + ('b' * 1199)
$a | Should Be $b
}

In xUnit it's done very good: it always uses same length for the ellipses and only deletes the same context, so the final result is representative (I think it also includes the offsets after the ellipsis).
I think I can take this one -- looking at xUnit, the final output should be something like:
Expected strings to be the same, but they were different.
String lengths are both 2500.
Strings differ at index 1300.
Expected: '...aaaaaabbbb...'
But was: '...aaaaabbbbb...'
-------------------^
@jd-porter nice, thank you for working on it!