metafacture / metafacture-fix

Work in progress towards an implementation of the Fix language for Metafacture
Apache License 2.0
6 stars 2 forks source link

array of strings + copy_field with $append #148

Open TobiasNx opened 2 years ago

TobiasNx commented 2 years ago
{
    "a": ["b", "c", "d"],
    "w": "e",
    "z": []
}

fix:

copy_field("a[]", "z[].$append")
copy_field("a[].*", "z[].$append")
copy_field("w", "z[].$append")

result:

{
  "a" : [ "b", "c", "d" ],
  "w" : "e",
  "z" : [ "b", "c", "d", "b", "c", "d", "e" ]
}

expected:

{
  "a" : [ "b", "c", "d" ],
  "w" : "e",
  "z" : [ ["b", "c", "d"], "b", "c", "d", "e" ]
}

copy_field("a[]", "z[].$append") without * operates exactly as copy_field("a[].*", "z[].$append")

This is in my opinion wrong. I will build a test for that later.

fsteeg commented 2 years ago

Revisit / add as unit test after https://github.com/metafacture/metafacture-fix/issues/102.

blackwinter commented 11 months ago

Integration tests: