mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-07 22:35:37 +00:00
Merge 90a55f7962 into e2f1d5ccf7
This commit is contained in:
commit
b211692a0e
@ -44,7 +44,7 @@ func hasOperator(d *dataTreeNavigator, context Context, expressionNode *Expressi
|
|||||||
if errParsingInt != nil {
|
if errParsingInt != nil {
|
||||||
return Context{}, errParsingInt
|
return Context{}, errParsingInt
|
||||||
}
|
}
|
||||||
candidateHasKey = int64(len(contents)) > number
|
candidateHasKey = number >= 0 && int64(len(contents)) > number
|
||||||
}
|
}
|
||||||
results.PushBack(createBooleanCandidate(candidate, candidateHasKey))
|
results.PushBack(createBooleanCandidate(candidate, candidateHasKey))
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -71,6 +71,16 @@ var hasOperatorScenarios = []expressionScenario{
|
|||||||
"D0, P[4], (!!bool)::true\n",
|
"D0, P[4], (!!bool)::true\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
skipDoc: true,
|
||||||
|
description: "Negative array index is never present",
|
||||||
|
document: "[[1, 2, 3], []]",
|
||||||
|
expression: `.[] | has(-1)`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[0], (!!bool)::false\n",
|
||||||
|
"D0, P[1], (!!bool)::false\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHasOperatorScenarios(t *testing.T) {
|
func TestHasOperatorScenarios(t *testing.T) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user