http/httpproxy: fix build on Go 1.8

Go 1.8 doesn't have t.Helper.

Fix the row of red on the dashboard.

Change-Id: I85d4bb9fe38e989dc3b6a4e99705599745b83cef
Reviewed-on: https://go-review.googlesource.com/80140
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Brad Fitzpatrick
2017-11-28 02:37:14 +00:00
parent e6a4aa30b6
commit fc492d2e10
2 changed files with 17 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.9
package httpproxy_test
import "testing"
func init() {
setHelper = func(t *testing.T) { t.Helper() }
}

View File

@@ -16,6 +16,9 @@ import (
"golang.org/x/net/http/httpproxy"
)
// setHelper calls t.Helper() for Go 1.9+ (see go19_test.go) and does nothing otherwise.
var setHelper = func(t *testing.T) {}
type proxyForURLTest struct {
cfg httpproxy.Config
req string // URL to fetch; blank means "http://example.com"
@@ -166,7 +169,7 @@ var proxyForURLTests = []proxyForURLTest{{
}}
func testProxyForURL(t *testing.T, tt proxyForURLTest) {
t.Helper()
setHelper(t)
reqURLStr := tt.req
if reqURLStr == "" {
reqURLStr = "http://example.com"