本文整理汇总了Golang中github.com/codegangsta/cli.Float64Flag类的典型用法代码示例。如果您正苦于以下问题:Golang Float64Flag类的具体用法?Golang Float64Flag怎么用?Golang Float64Flag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Float64Flag类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestFloatFlagWithoutDefaultValue
func TestFloatFlagWithoutDefaultValue(t *testing.T) {
flag := cli.Float64Flag{Name: "help", Usage: "Prints floating help topics", OmitDefaultValue: true}
output := flag.String()
expected := "--help \tPrints floating help topics"
if output != expected {
t.Errorf("expected '%s' to equal '%s", output, expected)
}
}
示例2: TestFloat64FlagHelpOutput
func TestFloat64FlagHelpOutput(t *testing.T) {
for _, test := range float64FlagTests {
flag := cli.Float64Flag{Name: test.name}
output := flag.String()
if output != test.expected {
t.Errorf("%s does not match %s", output, test.expected)
}
}
}
示例3: TestFloat64FlagWithEnvVarHelpOutput
func TestFloat64FlagWithEnvVarHelpOutput(t *testing.T) {
os.Setenv("APP_BAZ", "99.4")
for _, test := range float64FlagTests {
flag := cli.Float64Flag{Name: test.name, EnvVar: "APP_BAZ"}
output := flag.String()
if !strings.HasSuffix(output, " [$APP_BAZ]") {
t.Errorf("%s does not end with [$APP_BAZ]", output)
}
}
}