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}`,
expected: []string{expectedUpdatedArrayRef},
},
{ // Merge anchor with inline map
skipDoc: true,
document: `{<<: {a: 42}}`,
expression: `explode(.)`,
{
skipDoc: true,
description: "Merge anchor with inline map",
document: `{<<: {a: 42}}`,
expression: `explode(.)`,
expected: []string{
"D0, P[], (!!map)::{a: 42}\n",
},
},
{ // Merge anchor with sequence with inline map
skipDoc: true,
document: `{<<: [{a: 42}]}`,
expression: `explode(.)`,
{
skipDoc: true,
description: "Merge anchor with sequence with inline map",
document: `{<<: [{a: 42}]}`,
expression: `explode(.)`,
expected: []string{
"D0, P[], (!!map)::{a: 42}\n",
},
},
{ // Merge anchor with aliased sequence with inline map
skipDoc: true,
document: `{s: &s [{a: 42}], m: {<<: *s}}`,
expression: `.m | explode(.)`,
{
skipDoc: true,
description: "Merge anchor with aliased sequence with inline map",
document: `{s: &s [{a: 42}], m: {<<: *s}}`,
expression: `.m | explode(.)`,
expected: []string{
"D0, P[m], (!!map)::{a: 42}\n",
},
},
{ // Exploding merge anchor should not explode neighbors
skipDoc: true,
// b must not be exploded, as `r: *a` will become invalid
document: `{b: &b {a: &a 42}, r: *a, c: {<<: *b}}`,
expression: `explode(.c)`,
{
skipDoc: true,
description: "Exploding merge anchor should not explode neighbors",
subdescription: "b must not be exploded, as `r: *a` will become invalid",
document: `{b: &b {a: &a 42}, r: *a, c: {<<: *b}}`,
expression: `explode(.c)`,
expected: []string{
"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,
// b must not be exploded, as `r: *a` will become invalid
document: `{b: &b {a: &a 42}, r: *a, c: {<<: [*b]}}`,
expression: `explode(.c)`,
{
skipDoc: true,
description: "Exploding sequence merge anchor should not explode neighbors",
subdescription: "b must not be exploded, as `r: *a` will become invalid",
document: `{b: &b {a: &a 42}, r: *a, c: {<<: [*b]}}`,
expression: `explode(.c)`,
expected: []string{
"D0, P[], (!!map)::{b: &b {a: &a 42}, r: *a, c: {a: &a 42}}\n",
},
},
{ // Exploding inline merge anchor
skipDoc: true,
// `<<` map must be exploded, otherwise `c: *b` will become invalid
document: `{a: {b: &b 42}, <<: {c: *b}}`,
expression: `explode(.)`,
{
skipDoc: true,
description: "Exploding inline merge anchor",
subdescription: "`<<` map must be exploded, otherwise `c: *b` will become invalid",
document: `{a: {b: &b 42}, <<: {c: *b}}`,
expression: `explode(.)`,
expected: []string{
"D0, P[], (!!map)::{a: {b: 42}, c: 42}\n",
},
},
{ // Exploding inline merge anchor in sequence
skipDoc: true,
// `<<` map must be exploded, otherwise `c: *b` will become invalid
document: `{a: {b: &b 42}, <<: [{c: *b}]}`,
expression: `explode(.)`,
{
skipDoc: true,
description: "Exploding inline merge anchor in sequence",
subdescription: "`<<` map must be exploded, otherwise `c: *b` will become invalid",
document: `{a: {b: &b 42}, <<: [{c: *b}]}`,
expression: `explode(.)`,
expected: []string{
"D0, P[], (!!map)::{a: {b: 42}, c: 42}\n",
},

View File

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