mirror of
https://github.com/golang/go
synced 2024-11-21 22:34:48 -07:00
big: fix nat.scan bug
Scanning "0" with detected base did not actually set the nat to 0. R=gri CC=golang-dev https://golang.org/cl/4923050
This commit is contained in:
parent
42687d6ce4
commit
de20cec9c9
@ -301,6 +301,9 @@ func TestGetString(t *testing.T) {
|
||||
func TestSetString(t *testing.T) {
|
||||
tmp := new(Int)
|
||||
for i, test := range stringTests {
|
||||
// initialize to a non-zero value so that issues with parsing
|
||||
// 0 are detected
|
||||
tmp.SetInt64(1234567890)
|
||||
n1, ok1 := new(Int).SetString(test.in, test.base)
|
||||
n2, ok2 := tmp.SetString(test.in, test.base)
|
||||
expected := NewInt(test.val)
|
||||
|
@ -646,7 +646,7 @@ func (z nat) scan(r io.RuneScanner, base int) (nat, int, os.Error) {
|
||||
}
|
||||
}
|
||||
case os.EOF:
|
||||
return z, 10, nil
|
||||
return z.make(0), 10, nil
|
||||
default:
|
||||
return z, 10, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user