mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
Fixed string, null concact consistency #1712
This commit is contained in:
parent
71f95ab87b
commit
55c0d485ba
@ -107,7 +107,11 @@ func addScalars(context Context, target *CandidateNode, lhs *yaml.Node, rhs *yam
|
|||||||
|
|
||||||
} else if lhsTag == "!!str" {
|
} else if lhsTag == "!!str" {
|
||||||
target.Node.Tag = lhs.Tag
|
target.Node.Tag = lhs.Tag
|
||||||
target.Node.Value = lhs.Value + rhs.Value
|
if rhsTag == "!!null" {
|
||||||
|
target.Node.Value = lhs.Value
|
||||||
|
} else {
|
||||||
|
target.Node.Value = lhs.Value + rhs.Value
|
||||||
|
}
|
||||||
} else if rhsTag == "!!str" {
|
} else if rhsTag == "!!str" {
|
||||||
target.Node.Tag = rhs.Tag
|
target.Node.Tag = rhs.Tag
|
||||||
target.Node.Value = lhs.Value + rhs.Value
|
target.Node.Value = lhs.Value + rhs.Value
|
||||||
|
@ -225,6 +225,20 @@ var addOperatorScenarios = []expressionScenario{
|
|||||||
"D0, P[], (!cool)::3cat\n",
|
"D0, P[], (!cool)::3cat\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
skipDoc: true,
|
||||||
|
expression: `null + "cat"`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[], (!!str)::cat\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skipDoc: true,
|
||||||
|
expression: `"cat" + null`,
|
||||||
|
expected: []string{
|
||||||
|
"D0, P[], (!!str)::cat\n",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: "Number addition - float",
|
description: "Number addition - float",
|
||||||
subdescription: "If the lhs or rhs are floats then the expression will be calculated with floats.",
|
subdescription: "If the lhs or rhs are floats then the expression will be calculated with floats.",
|
||||||
|
Loading…
Reference in New Issue
Block a user