1
0
mirror of https://github.com/aquasecurity/kube-bench.git synced 2025-07-08 23:58:31 +00:00

Added empty op val and non-empty flagName test

This commit is contained in:
Arjun Khunti 2023-10-31 15:20:56 +05:30 committed by GitHub
parent 0918b41eca
commit 8d38c84713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -143,7 +143,7 @@ func (t flagTestItem) findValue(s string) (match bool, value string, err error)
if strings.HasPrefix(t.Flag, "--") { if strings.HasPrefix(t.Flag, "--") {
value = "true" value = "true"
} else { } else {
value = vals[1] value = ""
} }
} }
} else { } else {

View File

@ -600,6 +600,7 @@ func TestCompareOp(t *testing.T) {
// Test Op "eq" // Test Op "eq"
{label: "op=eq, both empty", op: "eq", flagVal: "", compareValue: "", expectedResultPattern: "'' is equal to ''", testResult: true, flagName: ""}, {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: "'' is equal to ''", testResult: true, flagName: "flagName"},
{ {
label: "op=eq, true==true", op: "eq", flagVal: "true", label: "op=eq, true==true", op: "eq", flagVal: "true",