Move new merge test comments to description field

This commit is contained in:
Steven WdV 2025-07-10 15:02:13 +02:00
parent 78c096fa8f
commit fa6dc5c9fb
No known key found for this signature in database
2 changed files with 54 additions and 44 deletions

View File

@ -283,62 +283,69 @@ var anchorOperatorScenarios = []expressionScenario{
expression: `.thingOne |= explode(.) * {"value": false}`, expression: `.thingOne |= explode(.) * {"value": false}`,
expected: []string{expectedUpdatedArrayRef}, expected: []string{expectedUpdatedArrayRef},
}, },
{ // Merge anchor with inline map {
skipDoc: true, skipDoc: true,
document: `{<<: {a: 42}}`, description: "Merge anchor with inline map",
expression: `explode(.)`, document: `{<<: {a: 42}}`,
expression: `explode(.)`,
expected: []string{ expected: []string{
"D0, P[], (!!map)::{a: 42}\n", "D0, P[], (!!map)::{a: 42}\n",
}, },
}, },
{ // Merge anchor with sequence with inline map {
skipDoc: true, skipDoc: true,
document: `{<<: [{a: 42}]}`, description: "Merge anchor with sequence with inline map",
expression: `explode(.)`, document: `{<<: [{a: 42}]}`,
expression: `explode(.)`,
expected: []string{ expected: []string{
"D0, P[], (!!map)::{a: 42}\n", "D0, P[], (!!map)::{a: 42}\n",
}, },
}, },
{ // Merge anchor with aliased sequence with inline map {
skipDoc: true, skipDoc: true,
document: `{s: &s [{a: 42}], m: {<<: *s}}`, description: "Merge anchor with aliased sequence with inline map",
expression: `.m | explode(.)`, document: `{s: &s [{a: 42}], m: {<<: *s}}`,
expression: `.m | explode(.)`,
expected: []string{ expected: []string{
"D0, P[m], (!!map)::{a: 42}\n", "D0, P[m], (!!map)::{a: 42}\n",
}, },
}, },
{ // Exploding merge anchor should not explode neighbors {
skipDoc: true, skipDoc: true,
// b must not be exploded, as `r: *a` will become invalid description: "Exploding merge anchor should not explode neighbors",
document: `{b: &b {a: &a 42}, r: *a, c: {<<: *b}}`, subdescription: "b must not be exploded, as `r: *a` will become invalid",
expression: `explode(.c)`, document: `{b: &b {a: &a 42}, r: *a, c: {<<: *b}}`,
expression: `explode(.c)`,
expected: []string{ expected: []string{
"D0, P[], (!!map)::{b: &b {a: &a 42}, r: *a, c: {a: &a 42}}\n", "D0, P[], (!!map)::{b: &b {a: &a 42}, r: *a, c: {a: &a 42}}\n",
}, },
}, },
{ // Exploding sequence merge anchor should not explode neighbors {
skipDoc: true, skipDoc: true,
// b must not be exploded, as `r: *a` will become invalid description: "Exploding sequence merge anchor should not explode neighbors",
document: `{b: &b {a: &a 42}, r: *a, c: {<<: [*b]}}`, subdescription: "b must not be exploded, as `r: *a` will become invalid",
expression: `explode(.c)`, document: `{b: &b {a: &a 42}, r: *a, c: {<<: [*b]}}`,
expression: `explode(.c)`,
expected: []string{ expected: []string{
"D0, P[], (!!map)::{b: &b {a: &a 42}, r: *a, c: {a: &a 42}}\n", "D0, P[], (!!map)::{b: &b {a: &a 42}, r: *a, c: {a: &a 42}}\n",
}, },
}, },
{ // Exploding inline merge anchor {
skipDoc: true, skipDoc: true,
// `<<` map must be exploded, otherwise `c: *b` will become invalid description: "Exploding inline merge anchor",
document: `{a: {b: &b 42}, <<: {c: *b}}`, subdescription: "`<<` map must be exploded, otherwise `c: *b` will become invalid",
expression: `explode(.)`, document: `{a: {b: &b 42}, <<: {c: *b}}`,
expression: `explode(.)`,
expected: []string{ expected: []string{
"D0, P[], (!!map)::{a: {b: 42}, c: 42}\n", "D0, P[], (!!map)::{a: {b: 42}, c: 42}\n",
}, },
}, },
{ // Exploding inline merge anchor in sequence {
skipDoc: true, skipDoc: true,
// `<<` map must be exploded, otherwise `c: *b` will become invalid description: "Exploding inline merge anchor in sequence",
document: `{a: {b: &b 42}, <<: [{c: *b}]}`, subdescription: "`<<` map must be exploded, otherwise `c: *b` will become invalid",
expression: `explode(.)`, document: `{a: {b: &b 42}, <<: [{c: *b}]}`,
expression: `explode(.)`,
expected: []string{ expected: []string{
"D0, P[], (!!map)::{a: {b: 42}, c: 42}\n", "D0, P[], (!!map)::{a: {b: 42}, c: 42}\n",
}, },

View File

@ -365,26 +365,29 @@ var traversePathOperatorScenarios = []expressionScenario{
"D0, P[0], (!!null)::null\n", "D0, P[0], (!!null)::null\n",
}, },
}, },
{ // Merge anchor with inline map {
skipDoc: true, skipDoc: true,
document: `{<<: {a: 42}}`, description: "Merge anchor with inline map",
expression: `.a`, document: `{<<: {a: 42}}`,
expression: `.a`,
expected: []string{ expected: []string{
"D0, P[<< a], (!!int)::42\n", "D0, P[<< a], (!!int)::42\n",
}, },
}, },
{ // Merge anchor with sequence with inline map {
skipDoc: true, skipDoc: true,
document: `{<<: [{a: 42}]}`, description: "Merge anchor with sequence with inline map",
expression: `.a`, document: `{<<: [{a: 42}]}`,
expression: `.a`,
expected: []string{ expected: []string{
"D0, P[<< 0 a], (!!int)::42\n", "D0, P[<< 0 a], (!!int)::42\n",
}, },
}, },
{ // Merge anchor with aliased sequence with inline map {
skipDoc: true, skipDoc: true,
document: `{s: &s [{a: 42}], m: {<<: *s}}`, description: "Merge anchor with aliased sequence with inline map",
expression: `.m.a`, document: `{s: &s [{a: 42}], m: {<<: *s}}`,
expression: `.m.a`,
expected: []string{ expected: []string{
"D0, P[s 0 a], (!!int)::42\n", "D0, P[s 0 a], (!!int)::42\n",
}, },