commit | d1a3b0e8f7433943e453d6c2de8b7dbea03f566e | [log] [tgz] |
---|---|---|
author | Keith Rarick <kr@xph.us> | Thu Jan 13 19:31:08 2011 -0800 |
committer | Keith Rarick <kr@xph.us> | Thu Jan 13 19:31:08 2011 -0800 |
tree | 86670fd8f1b33f5d5fcd5043e546bb14a38c1727 | |
parent | b5f2db3a80008e65bb59c50afef0f13ce699e58c [diff] |
test that we respect the original Format method
Package pretty provides pretty-printing for go values. This is useful during debugging, to avoid wrapping long output lines in the terminal.
It provides a function, Formatter, that can be used with any function that accepts a format string. For example,
type LongTypeName struct { longFieldName, otherLongFieldName int } func TestFoo(t *testing.T) { var x []LongTypeName{{1, 2}, {3, 4}, {5, 6}} t.Errorf("%# v", Formatter(x)) }
This package also provides a convenience wrapper for each function in package fmt that takes a format string.
$ goinstall github.com/kr/pretty.go
then
import "github.com/kr/pretty.go"