diff --git a/check/test.go b/check/test.go index 2aee9b0b0..8aad03d05 100644 --- a/check/test.go +++ b/check/test.go @@ -143,7 +143,11 @@ func (t flagTestItem) findValue(s string) (match bool, value string, err error) if strings.HasPrefix(t.Flag, "--") { value = "true" } else { - value = vals[1] + if t.Compare.Op == "eq" && !strings.Contains(t.Flag, ":") { + value = "" + } else { + value = vals[1] + } } } } else { diff --git a/check/test_test.go b/check/test_test.go index 29eb26922..ffd93555d 100644 --- a/check/test_test.go +++ b/check/test_test.go @@ -600,6 +600,7 @@ func TestCompareOp(t *testing.T) { // Test Op "eq" {label: "op=eq, both empty", op: "eq", flagVal: "", compareValue: "", expectedResultPattern: "'' is equal to ''", testResult: true, flagName: ""}, + {label: "op=eq, both empty, flagName non empty", op: "eq", flagVal: "", compareValue: "", expectedResultPattern: "'flagName' is equal to ''", testResult: true, flagName: "flagName"}, { label: "op=eq, true==true", op: "eq", flagVal: "true",