Commit c0e74b63 authored by Rob Pike's avatar Rob Pike

fmt: scan FALSE correctly

Fixes bug 2922.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5642072
parent 00d0f8e3
......@@ -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)) {
......
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