1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:04:41 -07:00

fmt: fix 386 build. error strings differ for overflow on 386.

R=gri
CC=golang-dev
https://golang.org/cl/1316042
This commit is contained in:
Rob Pike 2010-05-26 10:01:52 -07:00
parent 71f130f55c
commit 5b77928478

View File

@ -121,6 +121,8 @@ func TestScanln(t *testing.T) {
} }
func TestScanOverflow(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 { for _, test := range overflowTests {
r := strings.NewReader(test.text) r := strings.NewReader(test.text)
_, err := Scan(r, test.in) _, err := Scan(r, test.in)
@ -128,7 +130,7 @@ func TestScanOverflow(t *testing.T) {
t.Errorf("expected overflow scanning %q", test.text) t.Errorf("expected overflow scanning %q", test.text)
continue 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) t.Errorf("expected overflow error scanning %q: %s", test.text, err)
} }
} }