示例#1
0
文件: flag_test.go 项目: sombr/ccat
func TestIntSliceFlagHelpOutput(t *testing.T) {

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

		if output != test.expected {
			t.Errorf("%q does not match %q", output, test.expected)
		}
	}
}
示例#2
0
文件: flag_test.go 项目: sombr/ccat
func TestIntSliceFlagWithEnvVarHelpOutput(t *testing.T) {
	os.Clearenv()
	os.Setenv("APP_SMURF", "42,3")
	for _, test := range intSliceFlagTests {
		flag := cli.IntSliceFlag{Name: test.name, Value: test.value, EnvVar: "APP_SMURF"}
		output := flag.String()

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