git.lucas.co / go_mono
git clone https://git.lucas.co/go_mono.git

commit6d32002ffd7577f23673706728e1c510698cecb1
parent59b11bec70
authorBenny Siegert <bsiegert@gmail.com>
date2019-04-28 18:51
tiff: mark test and benchmark helpers

Mark helper functions for tiff tests with t.Helper and b.Helper
respectively.

Change-Id: I3242d5a9b319bcf8de17e34c731bcd1910acfb2b
Reviewed-on: https://go-review.googlesource.com/c/image/+/174140
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>

 tiff/reader_test.go | 2 ++
 tiff/writer_test.go | 1 +
 2 files changed, 3 insertions(+)

diff --git a/tiff/reader_test.go b/tiff/reader_test.go
index f1cf93b..53d2b3c 100644
--- a/tiff/reader_test.go
+++ b/tiff/reader_test.go
@@ -127,6 +127,7 @@ func TestDecodeInvalidDataType(t *testing.T) {
 }
 
 func compare(t *testing.T, img0, img1 image.Image) {
+	t.Helper()
 	b0 := img0.Bounds()
 	b1 := img1.Bounds()
 	if b0.Dx() != b1.Dx() || b0.Dy() != b1.Dy() {
@@ -376,6 +377,7 @@ func TestLargeIFDEntry(t *testing.T) {
 
 // benchmarkDecode benchmarks the decoding of an image.
 func benchmarkDecode(b *testing.B, filename string) {
+	b.Helper()
 	b.StopTimer()
 	contents, err := ioutil.ReadFile(testdataDir + filename)
 	if err != nil {
diff --git a/tiff/writer_test.go b/tiff/writer_test.go
index c8fb7bf..05e27d2 100644
--- a/tiff/writer_test.go
+++ b/tiff/writer_test.go
@@ -75,6 +75,7 @@ func TestRoundtrip2(t *testing.T) {
 }
 
 func benchmarkEncode(b *testing.B, name string, pixelSize int) {
+	b.Helper()
 	img, err := openImage(name)
 	if err != nil {
 		b.Fatal(err)