示例#1
0
文件: flag_test.go 项目: algoadv/etcd
func TestStringFlagHelpOutput(t *testing.T) {

	for _, test := range stringFlagTests {
		flag := cli.StringFlag{Name: test.name, Value: test.value}
		output := flag.String()

		if output != test.expected {
			t.Errorf("%s does not match %s", output, test.expected)
		}
	}
}
示例#2
0
文件: flag_test.go 项目: algoadv/etcd
func TestStringFlagWithEnvVarHelpOutput(t *testing.T) {

	os.Setenv("APP_FOO", "derp")
	for _, test := range stringFlagTests {
		flag := cli.StringFlag{Name: test.name, Value: test.value, EnvVar: "APP_FOO"}
		output := flag.String()

		if !strings.HasSuffix(output, " [$APP_FOO]") {
			t.Errorf("%s does not end with [$APP_FOO]", output)
		}
	}
}