mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-01 14:14:52 +08:00
Fixing special character example
This commit is contained in:
@@ -47,13 +47,21 @@ var traversePathOperatorScenarios = []expressionScenario{
|
||||
},
|
||||
{
|
||||
description: "Special characters",
|
||||
subdescription: "Use quotes around path elements with special characters",
|
||||
subdescription: "Use quotes with brackets around path elements with special characters",
|
||||
document: `{"{}": frog}`,
|
||||
expression: `."{}"`,
|
||||
expression: `.["{}"]`,
|
||||
expected: []string{
|
||||
"D0, P[{}], (!!str)::frog\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
document: `{"flying fox": frog}`,
|
||||
expression: `.["flying fox"]`,
|
||||
expected: []string{
|
||||
"D0, P[flying fox], (!!str)::frog\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Dynamic keys",
|
||||
subdescription: `Expressions within [] can be used to dynamically lookup / calculate keys`,
|
||||
|
||||
Reference in New Issue
Block a user