Commit 5b779284 authored by Rob Pike's avatar Rob Pike

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

R=gri
CC=golang-dev
https://golang.org/cl/1316042
parent 71f130f5
...@@ -121,6 +121,8 @@ func TestScanln(t *testing.T) { ...@@ -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) { ...@@ -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)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment