1
0
mirror of https://github.com/golang/go synced 2024-10-05 07:11:22 -06:00
go/src/fmt
Martin Möhrmann 8e23156786 fmt: refactor pointer formatting and improve tests
Uses a switch statement for direct format function selection
similar to other types verb handling in fmt.

Applies padding also to nil pointers formatted with %v.

Guards against "slice bounds out of range" panic in TestSprintf
when a pointer test results in a formatted string s
that is shorter than the index i the pointer should appear in.

Adds more and rearranges tests.

Fixes #14712
Fixes #14714

Change-Id: Iaf5ae37b7e6ba7d27d528d199f2b2eb9d5829b8c
Reviewed-on: https://go-review.googlesource.com/20371
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-03-09 20:59:50 +00:00
..
doc.go fmt: clarify reflect.Value printing 2015-10-19 18:29:36 +00:00
export_test.go all: make copyright headers consistent with one space after period 2016-03-01 23:34:33 +00:00
fmt_test.go fmt: refactor pointer formatting and improve tests 2016-03-09 20:59:50 +00:00
format.go fmt: refactor and unify float and complex formatting 2016-03-06 02:18:05 +00:00
print.go fmt: refactor pointer formatting and improve tests 2016-03-09 20:59:50 +00:00
scan_test.go all: single space after period. 2016-03-02 00:13:47 +00:00
scan.go all: single space after period. 2016-03-02 00:13:47 +00:00
stringer_test.go