From 54a540ffa274638992f4af1af8bfb3272ab262c6 Mon Sep 17 00:00:00 2001 From: Hiro Date: Tue, 1 Aug 2023 07:25:46 +0000 Subject: [PATCH] image/jpeg, image/png: replace Fatal with Error in tests Replaced t.Fatalf with t.Errorf for non-critical errors to footprint more failing test cases for better analysis of the error. Change-Id: I6f51d21e37a4ddb95d239d8afed2154f3ef52d31 GitHub-Last-Rev: d56aa49bced80c80f1177ae4b9ce038265ead551 GitHub-Pull-Request: golang/go#60524 Reviewed-on: https://go-review.googlesource.com/c/go/+/499336 Run-TryBot: Ian Lance Taylor TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Reviewed-by: David Chase --- src/image/jpeg/fuzz_test.go | 8 +++++--- src/image/png/fuzz_test.go | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/image/jpeg/fuzz_test.go b/src/image/jpeg/fuzz_test.go index bd534a921d..91a9914401 100644 --- a/src/image/jpeg/fuzz_test.go +++ b/src/image/jpeg/fuzz_test.go @@ -49,16 +49,18 @@ func FuzzDecode(f *testing.F) { var w bytes.Buffer err := Encode(&w, img, &Options{Quality: q}) if err != nil { - t.Fatalf("failed to encode valid image: %s", err) + t.Errorf("failed to encode valid image: %s", err) + continue } img1, err := Decode(&w) if err != nil { - t.Fatalf("failed to decode roundtripped image: %s", err) + t.Errorf("failed to decode roundtripped image: %s", err) + continue } got := img1.Bounds() want := img.Bounds() if !got.Eq(want) { - t.Fatalf("roundtripped image bounds have changed, got: %s, want: %s", got, want) + t.Errorf("roundtripped image bounds have changed, got: %s, want: %s", got, want) } } }) diff --git a/src/image/png/fuzz_test.go b/src/image/png/fuzz_test.go index 4b639459e7..ea4bf4ef4a 100644 --- a/src/image/png/fuzz_test.go +++ b/src/image/png/fuzz_test.go @@ -56,16 +56,18 @@ func FuzzDecode(f *testing.F) { e := &Encoder{CompressionLevel: l} err = e.Encode(&w, img) if err != nil { - t.Fatalf("failed to encode valid image: %s", err) + t.Errorf("failed to encode valid image: %s", err) + continue } img1, err := Decode(&w) if err != nil { - t.Fatalf("failed to decode roundtripped image: %s", err) + t.Errorf("failed to decode roundtripped image: %s", err) + continue } got := img1.Bounds() want := img.Bounds() if !got.Eq(want) { - t.Fatalf("roundtripped image bounds have changed, got: %s, want: %s", got, want) + t.Errorf("roundtripped image bounds have changed, got: %s, want: %s", got, want) } } }) -- 2.50.0