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

	for _, test := range durationFlagTests {
		flag := cli.DurationFlag{Name: test.name}
		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 TestDurationFlagWithEnvVarHelpOutput(t *testing.T) {

	os.Setenv("APP_BAR", "2h3m6s")
	for _, test := range durationFlagTests {
		flag := cli.DurationFlag{Name: test.name, EnvVar: "APP_BAR"}
		output := flag.String()

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