mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-06 18:24:57 +08:00
Fixed handling of nulls with sort_by expressions #2164
This commit is contained in:
@@ -21,6 +21,17 @@ var sortByOperatorScenarios = []expressionScenario{
|
||||
"D0, P[0], (!!map)::{a: banana}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Sort by with null",
|
||||
skipDoc: true,
|
||||
document: "[{a: banana},null,{a: apple}]",
|
||||
expression: `sort_by(.a)[]`,
|
||||
expected: []string{
|
||||
"D0, P[1], (!!null)::null\n",
|
||||
"D0, P[2], (!!map)::{a: apple}\n",
|
||||
"D0, P[0], (!!map)::{a: banana}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Sort by multiple fields",
|
||||
document: "[{a: dog},{a: cat, b: banana},{a: cat, b: apple}]",
|
||||
|
||||
Reference in New Issue
Block a user