Truncate object representations in test failure output messages that would cause the message to be too long to scan.
This is a different approach than that in #1559. I feel this is more appropriate because is it safer. The other approach has the potential to allocate excessive memory and to print excessive output to the console.
Changes
Make the message line indenter show an appropriate error if it fails to scan a line from the message.
Use the existing truncatingFormat function to truncate potentially long objects in assertions which format expected/actual values in full.
Parameterize the format string used by truncatingFormat.
Reduce the limit used by truncatingFormat by almost half to support failure messages showing both long expected and long actual values on the same line.
Change the format of NotSubset from %q to %#v to match that of Subset.
Motivation
So that people don't see no output in the failure message when making assertions (such as Len) against very long objects.
Summary
Truncate object representations in test failure output messages that would cause the message to be too long to scan.
This is a different approach than that in #1559. I feel this is more appropriate because is it safer. The other approach has the potential to allocate excessive memory and to print excessive output to the console.
Changes
truncatingFormat
function to truncate potentially long objects in assertions which format expected/actual values in full.truncatingFormat
.truncatingFormat
by almost half to support failure messages showing both long expected and long actual values on the same line.NotSubset
from%q
to%#v
to match that ofSubset
.Motivation
So that people don't see no output in the failure message when making assertions (such as
Len
) against very long objects.Related issues
Closes #1525