teach gtest how to pretty-print StringPiece values
Summary:
Even though an ostream operator<<() is defined for StringPiece, gtest doesn't
use it when printing StringPiece values in test failure messages. Because
StringPiece defines a nested iterator type gtest instead treats StringPiece as
a container, and prints each of its elements (characters) one-by-one. This is
fairly awkward to read.
This diff defines an explicit PrintTo() function for StringPiece in
folly/test/TestUtils.h. This makes gtest print StringPiece values nicely if
you include TestUtils.h in your test sources.
Reviewed By: yfeldblum
Differential Revision:
D4672257
fbshipit-source-id:
4b39ccc116e5382c29c37c2abe879293d310faf5