This commit is contained in:
Mike Farah
2021-12-04 13:25:32 +11:00
parent 055e441686
commit 2f05f7390f
7 changed files with 168 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
package yqlib
import "testing"
var sortByOperatorScenarios = []expressionScenario{
{
description: "Sort by string field",
document: "[{a: banana},{a: cat},{a: apple}]",
expression: `sort_by(.a)`,
expected: []string{
"D0, P[], (!!bool)::true\n",
},
},
// {
// description: "Sort, nulls come first",
// document: "[8,3,null,6]",
// expression: `sort`,
// expected: []string{
// "D0, P[], (!!bool)::[null,3,6,8]\n",
// },
// },
}
func TestSortByOperatorScenarios(t *testing.T) {
for _, tt := range sortByOperatorScenarios {
testScenario(t, &tt)
}
documentScenarios(t, "Sort", sortByOperatorScenarios)
}