mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 05:38:04 +00:00
Fixed tag operator for top level node
This commit is contained in:
parent
90ec05be54
commit
e28df367eb
@ -41,7 +41,7 @@ func assignTagOperator(d *dataTreeNavigator, matchingNodes *list.List, pathNode
|
||||
tag = rhs.Front().Value.(*CandidateNode).Node.Value
|
||||
}
|
||||
}
|
||||
candidate.Node.Tag = tag
|
||||
UnwrapDoc(candidate.Node).Tag = tag
|
||||
}
|
||||
|
||||
return matchingNodes, nil
|
||||
|
@ -26,6 +26,14 @@ var tagOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!str)::'!!map'\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
document: `32`,
|
||||
expression: `. tag= "!!str"`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::\"32\"\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Set custom tag",
|
||||
document: `{a: str}`,
|
||||
|
Loading…
Reference in New Issue
Block a user