From 67a97dce90a58890506ef25d86fa86ea9bba4501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=BClte?= Date: Tue, 1 Feb 2022 13:59:00 +0100 Subject: [PATCH] Update asterisks test https://github.com/metafacture/metafacture-fix/issues/121 --- data/testing/asteriskArray/asteriskArray.fix | 6 ++++++ data/testing/asteriskArray/expected.json | 17 ++++++++++++----- data/testing/asteriskArray/result.json | 7 +++++-- data/testing/asteriskArray/test.json | 6 ++++-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/data/testing/asteriskArray/asteriskArray.fix b/data/testing/asteriskArray/asteriskArray.fix index aee27d6..31d136e 100644 --- a/data/testing/asteriskArray/asteriskArray.fix +++ b/data/testing/asteriskArray/asteriskArray.fix @@ -3,11 +3,15 @@ set_array("TEST_TWO[]") copy_field("test[].*", "TEST_TWO[].$append") set_array("TEST_3[]") copy_field("test[].*", "TEST_THREE[].$append") +prepend("nestedTest[].*.test[].*", "Number ") +set_array("TEST_5[]") +copy_field("coll[].*.b", "TEST_5[].$append") replace_all("test[].*", "o", "__") append("test[].*", " is cool") replace_all("coll[].*.a", "o", "__") prepend("coll[].*.a", "HELLO ") +replace_all("nestedTest[].*.test[].*", "o", "__") lookup("animals[].*.Aanimal", "data/testing/asteriskArray/mapfile.tsv", "sep_char":"\t") @@ -16,8 +20,10 @@ set_array("TEST_4[]") copy_field("nestedTest[].*.test[].*", "TEST_4[].$append") split_field("others[].*.tools","--") sort_field("OTHERS[].*.dnimals[]") +add_field("coll[].*.c", "test") # ----------These break: + # reverse("TEST_3[].*") # reverse("ANIMALS[].*") diff --git a/data/testing/asteriskArray/expected.json b/data/testing/asteriskArray/expected.json index 5ea9347..55a6b58 100644 --- a/data/testing/asteriskArray/expected.json +++ b/data/testing/asteriskArray/expected.json @@ -1,13 +1,19 @@ { "test" : [ "One is cool", "Tw__ is cool", "Three is cool" ], "coll" : [ { - "a" : "HELLO D__g" + "a" : "HELLO D__g", + "b": "Dog", + "c": "test" }, { - "a" : "HELLO Ape" + "a" : "HELLO Ape", + "b": "Ape", + "c": "test" }, { - "a" : "HELLO Giraffe" + "a" : "HELLO Giraffe", + "c": "test" }, { - "a" : "HELLO Cr__c__dile" + "a" : "HELLO Cr__c__dile", + "c": "test" } ], "others" : [ { "name" : "Jake", @@ -40,5 +46,6 @@ } ], "TEST_TWO" : [ "One", "Two", "Three" ], "TEST_3" : [ "enO", "owT", "eerhT" ], - "Test_4": [ "One", "Two", "Three", "4", "5", "6"] + "Test_4": [ "One", "Two", "Three", "4", "5", "6"], + "TEST_5" : [ "Dog", "Ape" ] } diff --git a/data/testing/asteriskArray/result.json b/data/testing/asteriskArray/result.json index 177f5a3..cb5f5fd 100644 --- a/data/testing/asteriskArray/result.json +++ b/data/testing/asteriskArray/result.json @@ -1,13 +1,15 @@ { "test" : [ "One is cool", "Tw__ is cool", "Three is cool" ], "nestedTest" : [ { - "test" : [ "One", "Two", "Three" ] + "test" : [ "Number One", "Number Tw__", "Number Three" ] }, { - "test" : [ "4", "5", "6" ] + "test" : [ "Number 4", "Number 5", "Number 6" ] } ], "coll" : [ { + "b" : "Dog", "a" : "HELLO D__g" }, { + "b" : "Ape", "a" : "HELLO Ape" }, { "a" : "HELLO Giraffe" @@ -49,5 +51,6 @@ "2" : "Two", "3" : "Three" } ], + "TEST_5" : [ "Dog", "Ape" ], "TEST_4" : [ ] } diff --git a/data/testing/asteriskArray/test.json b/data/testing/asteriskArray/test.json index 3c5786f..fd79017 100644 --- a/data/testing/asteriskArray/test.json +++ b/data/testing/asteriskArray/test.json @@ -22,10 +22,12 @@ ], "coll": [ { - "a": "Dog" + "a": "Dog", + "b": "Dog" }, { - "a": "Ape" + "a": "Ape", + "b": "Ape" }, { "a": "Giraffe"