summaryrefslogtreecommitdiff
path: root/src/pkg/flag/flag_test.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-02-14 13:23:51 +0100
committerOndřej Surý <ondrej@sury.org>2011-02-14 13:23:51 +0100
commit758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch)
tree6d6b34f8c678862fe9b56c945a7b63f68502c245 /src/pkg/flag/flag_test.go
parent3e45412327a2654a77944249962b3652e6142299 (diff)
downloadgolang-upstream/2011-02-01.1.tar.gz
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'src/pkg/flag/flag_test.go')
-rw-r--r--src/pkg/flag/flag_test.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/pkg/flag/flag_test.go b/src/pkg/flag/flag_test.go
index 4ebb73805..b91a8b567 100644
--- a/src/pkg/flag/flag_test.go
+++ b/src/pkg/flag/flag_test.go
@@ -18,8 +18,7 @@ var (
test_uint = Uint("test_uint", 0, "uint value")
test_uint64 = Uint64("test_uint64", 0, "uint64 value")
test_string = String("test_string", "0", "string value")
- test_float = Float("test_float", 0, "float value")
- test_float64 = Float("test_float64", 0, "float64 value")
+ test_float64 = Float64("test_float64", 0, "float64 value")
)
func boolString(s string) string {
@@ -48,7 +47,7 @@ func TestEverything(t *testing.T) {
}
}
VisitAll(visitor)
- if len(m) != 8 {
+ if len(m) != 7 {
t.Error("VisitAll misses some flags")
for k, v := range m {
t.Log(k, *v)
@@ -69,11 +68,10 @@ func TestEverything(t *testing.T) {
Set("test_uint", "1")
Set("test_uint64", "1")
Set("test_string", "1")
- Set("test_float", "1")
Set("test_float64", "1")
desired = "1"
Visit(visitor)
- if len(m) != 8 {
+ if len(m) != 7 {
t.Error("Visit fails after set")
for k, v := range m {
t.Log(k, *v)
@@ -101,8 +99,7 @@ func TestParse(t *testing.T) {
uintFlag := Uint("uint", 0, "uint value")
uint64Flag := Uint64("uint64", 0, "uint64 value")
stringFlag := String("string", "0", "string value")
- floatFlag := Float("float", 0, "float value")
- float64Flag := Float("float64", 0, "float64 value")
+ float64Flag := Float64("float64", 0, "float64 value")
extra := "one-extra-argument"
args := []string{
"a.out",
@@ -113,7 +110,6 @@ func TestParse(t *testing.T) {
"-uint", "24",
"--uint64", "25",
"-string", "hello",
- "--float", "3141.5",
"-float64", "2718e28",
extra,
}
@@ -141,9 +137,6 @@ func TestParse(t *testing.T) {
if *stringFlag != "hello" {
t.Error("string flag should be `hello`, is ", *stringFlag)
}
- if *floatFlag != 3141.5 {
- t.Error("float flag should be 3141.5, is ", *floatFlag)
- }
if *float64Flag != 2718e28 {
t.Error("float64 flag should be 2718e28, is ", *float64Flag)
}