From 5b779284783fffdc1f573811b2b792fd83dea347 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Wed, 26 May 2010 10:01:52 -0700 Subject: [PATCH] fmt: fix 386 build. error strings differ for overflow on 386. R=gri CC=golang-dev https://golang.org/cl/1316042 --- src/pkg/fmt/scan_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pkg/fmt/scan_test.go b/src/pkg/fmt/scan_test.go index a49fb90a48e..1c974e4d5a2 100644 --- a/src/pkg/fmt/scan_test.go +++ b/src/pkg/fmt/scan_test.go @@ -121,6 +121,8 @@ func TestScanln(t *testing.T) { } func TestScanOverflow(t *testing.T) { + // different machines and different types report errors with different strings. + re := testing.MustCompile("overflow|too large|out of range|not representable") for _, test := range overflowTests { r := strings.NewReader(test.text) _, err := Scan(r, test.in) @@ -128,7 +130,7 @@ func TestScanOverflow(t *testing.T) { t.Errorf("expected overflow scanning %q", test.text) continue } - if strings.Index(err.String(), "overflow") < 0 && strings.Index(err.String(), "too large") < 0 { + if !re.MatchString(err.String()) { t.Errorf("expected overflow error scanning %q: %s", test.text, err) } }