1
0
mirror of https://github.com/golang/go synced 2024-10-05 06:21:24 -06:00
go/src/cmd/fix/strconv_test.go
Rob Pike 71d83b72ef cmd/go: add go tools to rearrangement
fix, vet
yacc is also fixed (it was wrong before)
All that's left is the commands used during compilation
This looks like a huge CL, but it's almost all file renames.
The action is in cmd/go/pkg.go, the Makefiles, and .../doc.go.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5595044
2012-01-29 11:07:25 -08:00

94 lines
1.7 KiB
Go

// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
func init() {
addTestCases(strconvTests, strconvFn)
}
var strconvTests = []testCase{
{
Name: "strconv.0",
In: `package main
import "strconv"
func f() {
foo.Atob("abc")
strconv.Atob("true")
strconv.Btoa(false)
strconv.Atof32("1.2")
strconv.Atof64("1.2")
strconv.AtofN("1.2", 64)
strconv.Ftoa32(1.2, 'g', 17)
strconv.Ftoa64(1.2, 'g', 17)
strconv.FtoaN(1.2, 'g', 17, 64)
strconv.Atoi("3")
strconv.Atoi64("3")
strconv.Btoi64("1234", 5)
strconv.Atoui("3")
strconv.Atoui64("3")
strconv.Btoui64("1234", 5)
strconv.Itoa(123)
strconv.Itoa64(1234)
strconv.Itob(123, 5)
strconv.Itob64(1234, 5)
strconv.Uitoa(123)
strconv.Uitoa64(1234)
strconv.Uitob(123, 5)
strconv.Uitob64(1234, 5)
strconv.Uitoa(uint(x))
strconv.Uitoa(f(x))
}
`,
Out: `package main
import "strconv"
func f() {
foo.Atob("abc")
strconv.ParseBool("true")
strconv.FormatBool(false)
strconv.ParseFloat("1.2", 32)
strconv.ParseFloat("1.2", 64)
strconv.ParseFloat("1.2", 64)
strconv.FormatFloat(float64(1.2), 'g', 17, 32)
strconv.FormatFloat(1.2, 'g', 17, 64)
strconv.FormatFloat(1.2, 'g', 17, 64)
strconv.Atoi("3")
strconv.ParseInt("3", 10, 64)
strconv.ParseInt("1234", 5, 64)
strconv.ParseUint("3", 10, 0)
strconv.ParseUint("3", 10, 64)
strconv.ParseUint("1234", 5, 64)
strconv.Itoa(123)
strconv.FormatInt(1234, 10)
strconv.FormatInt(int64(123), 5)
strconv.FormatInt(1234, 5)
strconv.FormatUint(uint64(123), 10)
strconv.FormatUint(1234, 10)
strconv.FormatUint(uint64(123), 5)
strconv.FormatUint(1234, 5)
strconv.FormatUint(uint64(x), 10)
strconv.FormatUint(uint64(f(x)), 10)
}
`,
},
}