예제 #1
0
func TestGenericFlagHelpOutput(t *testing.T) {

	for _, test := range genericFlagTests {
		flag := cli.GenericFlag{Name: test.name}
		output := flag.String()

		if output != test.expected {
			t.Errorf("%q does not match %q", output, test.expected)
		}
	}
}
예제 #2
0
func TestGenericFlagWithEnvVarHelpOutput(t *testing.T) {

	os.Setenv("APP_ZAP", "3")
	for _, test := range genericFlagTests {
		flag := cli.GenericFlag{Name: test.name, EnvVar: "APP_ZAP"}
		output := flag.String()

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