Tweaking select docs

This commit is contained in:
Mike Farah
2022-01-15 18:22:26 +11:00
parent 21cdbab0d7
commit de0716e875
2 changed files with 32 additions and 32 deletions
+11 -11
View File
@@ -27,16 +27,6 @@ var selectOperatorScenarios = []expressionScenario{
expression: `select(false)`,
expected: []string{},
},
{
description: "Select elements from array with regular expression",
subdescription: "See more regular expression examples under the `string` operator docs.",
document: `[this_0, not_this, nor_0_this, thisTo_4]`,
expression: `.[] | select(test("[a-zA-Z]+_[0-9]$"))`,
expected: []string{
"D0, P[0], (!!str)::this_0\n",
"D0, P[3], (!!str)::thisTo_4\n",
},
},
{
description: "Select elements from array using wildcard prefix",
document: `[cat,goat,dog]`,
@@ -65,6 +55,16 @@ var selectOperatorScenarios = []expressionScenario{
"D0, P[3], (!!str)::going\n",
},
},
{
description: "Select elements from array with regular expression",
subdescription: "See more regular expression examples under the `string` operator docs.",
document: `[this_0, not_this, nor_0_this, thisTo_4]`,
expression: `.[] | select(test("[a-zA-Z]+_[0-9]$"))`,
expected: []string{
"D0, P[0], (!!str)::this_0\n",
"D0, P[3], (!!str)::thisTo_4\n",
},
},
{
skipDoc: true,
document: "a: hello",
@@ -107,7 +107,7 @@ var selectOperatorScenarios = []expressionScenario{
},
},
{
description: "Use select + with_entries to filter map keys",
description: "Use select and with_entries to filter map keys",
document: `{name: bob, legs: 2, game: poker}`,
expression: `with_entries(select(.key | test("ame$")))`,
expected: []string{