1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 type atobTest
struct {
18 var atobtests
= []atobTest
{
19 {"", false, ErrSyntax
},
20 {"asdf", false, ErrSyntax
},
24 {"FALSE", false, nil},
25 {"false", false, nil},
26 {"False", false, nil},
35 func TestParseBool(t
*testing
.T
) {
36 for _
, test
:= range atobtests
{
37 b
, e
:= ParseBool(test
.in
)
41 t
.Errorf("%s: expected %s but got nil", test
.in
, test
.err
)
43 // NumError assertion must succeed; it's the only thing we return.
44 if test
.err
!= e
.(*NumError
).Err
{
45 t
.Errorf("%s: expected %s but got %s", test
.in
, test
.err
, e
)
50 t
.Errorf("%s: expected no error but got %s", test
.in
, e
)
53 t
.Errorf("%s: expected %t but got %t", test
.in
, test
.out
, b
)