Commit 4d06dbda authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

http2: reduce alloc-heavy init

Moves test cases into the test where they're used, to remove
distractions when profiling unrelated tests.

Also this is my style preference, to remove globals and reduce the
scope of variables.

Change-Id: Ie9cd41b16aad9acf5e210f1fb6f19a7fce52180d
Reviewed-on: https://go-review.googlesource.com/20996Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
parent 9d8ef8d7
......@@ -326,10 +326,11 @@ func randString(n int) string {
return string(b)
}
var bodyTests = []struct {
func TestTransportBody(t *testing.T) {
bodyTests := []struct {
body string
noContentLen bool
}{
}{
{body: "some message"},
{body: "some message", noContentLen: true},
{body: ""},
......@@ -345,9 +346,8 @@ var bodyTests = []struct {
{body: randString(1<<20 - 1)},
{body: randString(1 << 20)},
{body: randString(1<<20 + 2)},
}
}
func TestTransportBody(t *testing.T) {
type reqInfo struct {
req *http.Request
slurp []byte
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment