From 0a9d6c1f9f9938cdd0edbb0f97ba0917d52e4c0d Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 15 Nov 2017 18:35:58 +0000 Subject: git-codereview: fix test compilation error on Go 1.8 These tests depended on Go 1.9's t.Helper. Change-Id: Ib8196e24f8508b4b2891cd1467dd9954bc5d8de5 Reviewed-on: https://go-review.googlesource.com/77932 Reviewed-by: Dominik Honnef --- git-codereview/go19_test.go | 13 +++++++++++++ git-codereview/pending_test.go | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 git-codereview/go19_test.go diff --git a/git-codereview/go19_test.go b/git-codereview/go19_test.go new file mode 100644 index 0000000..784ec41 --- /dev/null +++ b/git-codereview/go19_test.go @@ -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 main + +import "testing" + +func init() { + setHelper = func(t *testing.T) { t.Helper() } +} diff --git a/git-codereview/pending_test.go b/git-codereview/pending_test.go index e29d0eb..025fb5b 100644 --- a/git-codereview/pending_test.go +++ b/git-codereview/pending_test.go @@ -14,6 +14,9 @@ import ( "testing" ) +// setHelper calls t.Helper() for Go 1.9+ (see go19_test.go) and does nothing otherwise. +var setHelper = func(t *testing.T) {} + func TestPendingNone(t *testing.T) { gt := newGitTest(t) defer gt.done() @@ -496,12 +499,12 @@ func testPendingReply(srv *gerritServer, id, rev, status string) { } func testPending(t *testing.T, want string) { - t.Helper() + setHelper(t) testPendingArgs(t, nil, want) } func testPendingArgs(t *testing.T, args []string, want string) { - t.Helper() + setHelper(t) // fake auth information to avoid Gerrit error if auth.host == "" { auth.host = "gerrit.fake" -- cgit v1.3