mirror of
https://github.com/golang/go
synced 2024-11-19 23:14:47 -07:00
strconv: document and test True and False for Atob
R=golang-dev CC=golang-dev https://golang.org/cl/4535057
This commit is contained in:
parent
a005617c5a
commit
142008c325
@ -7,8 +7,8 @@ package strconv
|
|||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
// Atob returns the boolean value represented by the string.
|
// Atob returns the boolean value represented by the string.
|
||||||
// It accepts 1, t, T, TRUE, true, 0, f, F, FALSE, false. Any other value returns
|
// It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False.
|
||||||
// an error.
|
// Any other value returns an error.
|
||||||
func Atob(str string) (value bool, err os.Error) {
|
func Atob(str string) (value bool, err os.Error) {
|
||||||
switch str {
|
switch str {
|
||||||
case "1", "t", "T", "true", "TRUE", "True":
|
case "1", "t", "T", "true", "TRUE", "True":
|
||||||
|
@ -24,11 +24,13 @@ var atobtests = []atobTest{
|
|||||||
{"F", false, nil},
|
{"F", false, nil},
|
||||||
{"FALSE", false, nil},
|
{"FALSE", false, nil},
|
||||||
{"false", false, nil},
|
{"false", false, nil},
|
||||||
|
{"False", false, nil},
|
||||||
{"1", true, nil},
|
{"1", true, nil},
|
||||||
{"t", true, nil},
|
{"t", true, nil},
|
||||||
{"T", true, nil},
|
{"T", true, nil},
|
||||||
{"TRUE", true, nil},
|
{"TRUE", true, nil},
|
||||||
{"true", true, nil},
|
{"true", true, nil},
|
||||||
|
{"True", true, nil},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAtob(t *testing.T) {
|
func TestAtob(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user