dart-lang / test

A library for writing unit tests in Dart.
https://pub.dev/packages/test
497 stars 214 forks source link

Provide a way to customize pretty printing #2347

Open Hixie opened 8 years ago

Hixie commented 8 years ago

When expect notices an error, it outputs an Expected: Actual: Which: block of text.

The Actual: line, however, wraps the value in angle brackets.

Sometimes, the value I want to print isn't a literal value, it's just an English-prose vague description of the value (the value itself being a gigantic tree that takes pages and pages to print and that isn't useful to print in this context).

This is a feature request to have a way to provide a pretty printer for values, e.g. by implementing a particular interface, or by having the matchers provide the pretty printer for the value, and allowing this API to omit the angle brackets.

matanlurey commented 8 years ago

+1, just ran into this recently. The pretty printer tries to do too clever things.