mirror of
https://github.com/golang/go
synced 2024-11-19 15:54:46 -07:00
fmt: scan FALSE correctly
Fixes bug 2922. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5642072
This commit is contained in:
parent
00d0f8e320
commit
c0e74b63cf
@ -512,7 +512,7 @@ func (s *ss) scanBool(verb rune) bool {
|
||||
}
|
||||
return true
|
||||
case 'f', 'F':
|
||||
if s.accept("aL") && (!s.accept("lL") || !s.accept("sS") || !s.accept("eE")) {
|
||||
if s.accept("aA") && (!s.accept("lL") || !s.accept("sS") || !s.accept("eE")) {
|
||||
s.error(boolError)
|
||||
}
|
||||
return false
|
||||
|
@ -317,6 +317,7 @@ var overflowTests = []ScanTest{
|
||||
{"(1-1e500i)", &complex128Val, 0},
|
||||
}
|
||||
|
||||
var truth bool
|
||||
var i, j, k int
|
||||
var f float64
|
||||
var s, t string
|
||||
@ -350,6 +351,9 @@ var multiTests = []ScanfMultiTest{
|
||||
|
||||
// Bad UTF-8: should see every byte.
|
||||
{"%c%c%c", "\xc2X\xc2", args(&r1, &r2, &r3), args(utf8.RuneError, 'X', utf8.RuneError), ""},
|
||||
|
||||
// Fixed bugs
|
||||
{"%v%v", "FALSE23", args(&truth, &i), args(false, 23), ""},
|
||||
}
|
||||
|
||||
func testScan(name string, t *testing.T, scan func(r io.Reader, a ...interface{}) (int, error)) {
|
||||
|
Loading…
Reference in New Issue
Block a user