Пример #1
0
func TestStringSliceFlagHelpOutput(t *testing.T) {

	for _, test := range stringSliceFlagTests {
		flag := cli.StringSliceFlag{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
func TestStringSliceFlagWithEnvVarHelpOutput(t *testing.T) {

	os.Setenv("APP_QWWX", "11,4")
	for _, test := range stringSliceFlagTests {
		flag := cli.StringSliceFlag{Name: test.name, Value: test.value, EnvVar: "APP_QWWX"}
		output := flag.String()

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