yq/pkg/yqlib/treeops/operator_booleans_test.go

37 lines
697 B
Go
Raw Normal View History

2020-10-17 11:10:47 +00:00
package treeops
import (
"testing"
)
var booleanOperatorScenarios = []expressionScenario{
{
document: `{}`,
expression: `true or false`,
expected: []string{
"D0, P[], (!!bool)::true\n",
},
}, {
document: `{}`,
expression: `false or false`,
expected: []string{
"D0, P[], (!!bool)::false\n",
},
}, {
document: `{a: true, b: false}`,
expression: `.[] or (false, true)`,
expected: []string{
2020-10-21 01:54:58 +00:00
"D0, P[a], (!!bool)::true\n",
2020-10-17 11:10:47 +00:00
"D0, P[a], (!!bool)::true\n",
"D0, P[b], (!!bool)::false\n",
"D0, P[b], (!!bool)::true\n",
},
},
}
func TestBooleanOperatorScenarios(t *testing.T) {
for _, tt := range booleanOperatorScenarios {
testScenario(t, &tt)
}
}