summaryrefslogtreecommitdiff
path: root/src/pkg/fmt/stringer_test.go
AgeCommit message (Collapse)AuthorFilesLines
2015-01-15Imported Upstream version 1.4upstream/1.4Tianon Gravi1-61/+0
2011-09-13Imported Upstream version 60upstream/60Ondřej Surý1-0/+61
2011-09-13Imported Upstream version 60Ondřej Surý1-61/+0
2011-02-14Imported Upstream version 2011-02-01.1upstream/2011-02-01.1Ondřej Surý1-2/+2
2010-06-14fmt.Print*: reimplement to switch on type first.Rob Pike1-15/+15
This shortens, simplifies and regularizes the code significantly. (Improvements to reflect could make another step.) Passes all.bash. One semantic change occurs: The String() method changes behavior. It used to run only for string formats such as %s and %q. Instead, it now runs whenever the item has the method and the result is then processed by the format as a string. Besides the regularization, this has three effects: 1) width is honored for String() items 2) %x works for String() items 3) implementations of String that merely recur will recur forever Regarding point 3, example from the updated documentation: type X int func (x X) String() string { return Sprintf("%d", x) } should cast the value before recurring: func (x X) String() string { return Sprintf("%d", int(x)) } R=rsc CC=golang-dev http://codereview.appspot.com/1613045
2010-02-25%q in fmt: if the object is a Stringer, use String() to get the value to quote.Rob Pike1-1/+1
R=rsc CC=golang-dev http://codereview.appspot.com/224051
2010-02-15Fix printing of named floating point types.Ian Lance Taylor1-0/+61
Try to avoid infinite recursion if String fails due to printing a bad type. Add test for String method with named basic types. R=r CC=golang-dev http://codereview.appspot.com/207102