]> Cypherpunks repositories - gostls13.git/commitdiff
fmt: fix allocation tests
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 18 Sep 2014 16:45:58 +0000 (09:45 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 18 Sep 2014 16:45:58 +0000 (09:45 -0700)
Converting an integer to an interface{} allocates as of CL 130240043.

Fixes #8617.

LGTM=r
R=r
CC=golang-codereviews, khr
https://golang.org/cl/141700043

src/fmt/fmt_test.go

index 89dde2b64aac522a969771cc785ff386441a6ac1..a212c9f7026a8169bc5a6f14b18409e4b6b219fd 100644 (file)
@@ -864,9 +864,9 @@ var mallocTest = []struct {
 }{
        {0, `Sprintf("")`, func() { Sprintf("") }},
        {1, `Sprintf("xxx")`, func() { Sprintf("xxx") }},
-       {1, `Sprintf("%x")`, func() { Sprintf("%x", 7) }},
+       {2, `Sprintf("%x")`, func() { Sprintf("%x", 7) }},
        {2, `Sprintf("%s")`, func() { Sprintf("%s", "hello") }},
-       {1, `Sprintf("%x %x")`, func() { Sprintf("%x %x", 7, 112) }},
+       {3, `Sprintf("%x %x")`, func() { Sprintf("%x %x", 7, 112) }},
        {2, `Sprintf("%g")`, func() { Sprintf("%g", float32(3.14159)) }}, // TODO: Can this be 1?
        {1, `Fprintf(buf, "%s")`, func() { mallocBuf.Reset(); Fprintf(&mallocBuf, "%s", "hello") }},
        // If the interface value doesn't need to allocate, amortized allocation overhead should be zero.