summaryrefslogtreecommitdiff
path: root/libgo/go/fmt/errors_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-01-02 15:05:27 -0800
committerIan Lance Taylor <iant@golang.org>2020-01-21 23:53:22 -0800
commit5a8ea165926cb0737ab03bc48c18dc5198ab5305 (patch)
tree962dc3357c57f019f85658f99e2e753e30201c27 /libgo/go/fmt/errors_test.go
parent6ac6529e155c9baa0aaaed7aca06bd38ebda5b43 (diff)
libgo: update to Go1.14beta1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/214297
Diffstat (limited to 'libgo/go/fmt/errors_test.go')
-rw-r--r--libgo/go/fmt/errors_test.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/libgo/go/fmt/errors_test.go b/libgo/go/fmt/errors_test.go
index 0c774bc28b6..481a7b84030 100644
--- a/libgo/go/fmt/errors_test.go
+++ b/libgo/go/fmt/errors_test.go
@@ -11,6 +11,10 @@ import (
)
func TestErrorf(t *testing.T) {
+ // noVetErrorf is an alias for fmt.Errorf that does not trigger vet warnings for
+ // %w format strings.
+ noVetErrorf := fmt.Errorf
+
wrapped := errors.New("inner error")
for _, test := range []struct {
err error
@@ -46,13 +50,13 @@ func TestErrorf(t *testing.T) {
err: fmt.Errorf("%v with added context", wrapped),
wantText: "inner error with added context",
}, {
- err: fmt.Errorf("%w is not an error", "not-an-error"),
+ err: noVetErrorf("%w is not an error", "not-an-error"),
wantText: "%!w(string=not-an-error) is not an error",
}, {
- err: fmt.Errorf("wrapped two errors: %w %w", errString("1"), errString("2")),
+ err: noVetErrorf("wrapped two errors: %w %w", errString("1"), errString("2")),
wantText: "wrapped two errors: 1 %!w(fmt_test.errString=2)",
}, {
- err: fmt.Errorf("wrapped three errors: %w %w %w", errString("1"), errString("2"), errString("3")),
+ err: noVetErrorf("wrapped three errors: %w %w %w", errString("1"), errString("2"), errString("3")),
wantText: "wrapped three errors: 1 %!w(fmt_test.errString=2) %!w(fmt_test.errString=3)",
}, {
err: fmt.Errorf("%w", nil),