From 4530b97a2f3fe9453d9ccb3a9a55216913e4baf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20B=C3=BClte?= Date: Tue, 25 Jan 2022 15:11:22 +0100 Subject: [PATCH] Update test function `append` & `prepend` https://github.com/metafacture/metafacture-fix/issues/100 --- data/review/append/animals_complex.json | 14 +++++++++++++- data/review/append/append.fix | 3 +++ data/review/append/expected.json | 10 +++++++++- data/review/append/result.json | 8 ++++++++ data/review/prepend/animals_complex.json | 14 +++++++++++++- data/review/prepend/expected.json | 11 +++++++++-- data/review/prepend/prepend.fix | 4 ++++ data/review/prepend/result.json | 8 ++++++++ 8 files changed, 67 insertions(+), 5 deletions(-) diff --git a/data/review/append/animals_complex.json b/data/review/append/animals_complex.json index 71e7adf..96bcb95 100644 --- a/data/review/append/animals_complex.json +++ b/data/review/append/animals_complex.json @@ -6,5 +6,17 @@ "name": "bird", "type": "TEST" }, - "ANIMALS": ["dog", "cat", "zebra"] + "ANIMALS": ["dog", "cat", "zebra"], + "others": [ + { + "name": "Jake", + "animal": "dog" + } + ], + "OTHERS": [ + { + "name": "Jake", + "animal": "dog" + } + ] } \ No newline at end of file diff --git a/data/review/append/append.fix b/data/review/append/append.fix index 9cb492d..1669505 100644 --- a/data/review/append/append.fix +++ b/data/review/append/append.fix @@ -5,5 +5,8 @@ append("animals[].1", " is cool") append("bnimals[].*", " is cool") +append("others[].1.animal", " is cool") +append("OTHERS[].*.animal", " is cool") + # This results in error: # append("ANIMALS[]", " is cool") \ No newline at end of file diff --git a/data/review/append/expected.json b/data/review/append/expected.json index 9b994af..d863758 100644 --- a/data/review/append/expected.json +++ b/data/review/append/expected.json @@ -6,5 +6,13 @@ "name": "bird boss", "type": "TEST" }, - "ANIMALS": ["dog", "cat", "zebra"] + "ANIMALS": ["dog", "cat", "zebra"], + "others" : [ { + "name" : "Jake", + "animal" : "dog is cool" + } ], + "OTHERS" : [ { + "name" : "Jake", + "animal" : "dog is cool" + } ] } \ No newline at end of file diff --git a/data/review/append/result.json b/data/review/append/result.json index 85ff1ca..7d5eee0 100644 --- a/data/review/append/result.json +++ b/data/review/append/result.json @@ -6,5 +6,13 @@ "name" : "bird boss" }, "ANIMALS" : [ "dog", "cat", "zebra" ], + "others" : [ { + "name" : "Jake", + "animal" : "dog is cool" + } ], + "OTHERS" : [ { + "name" : "Jake", + "animal" : "dog is cool" + } ], "animal" : "bunny is cool" } diff --git a/data/review/prepend/animals_complex.json b/data/review/prepend/animals_complex.json index f6c429f..c69d4ce 100644 --- a/data/review/prepend/animals_complex.json +++ b/data/review/prepend/animals_complex.json @@ -6,5 +6,17 @@ "name": "bird", "type": "TEST" }, - "ANIMALS": ["dog", "cat", "zebra"] + "ANIMALS": ["dog", "cat", "zebra"], + "others": [ + { + "name": "Jake", + "animal": "dog" + } + ], + "OTHERS": [ + { + "name": "Jake", + "animal": "dog" + } + ] } \ No newline at end of file diff --git a/data/review/prepend/expected.json b/data/review/prepend/expected.json index 02cf781..6edc3c7 100644 --- a/data/review/prepend/expected.json +++ b/data/review/prepend/expected.json @@ -6,6 +6,13 @@ "type" : "TEST", "name" : "Boss bird" }, - "ANIMALS": ["dog", "cat", "zebra"] - + "ANIMALS": ["dog", "cat", "zebra"], + "others" : [ { + "animal" : "dog", + "name" : "Hello Jake" + } ], + "OTHERS" : [ { + "animal" : "dog", + "name" : "Hi Jake" + } ] } \ No newline at end of file diff --git a/data/review/prepend/prepend.fix b/data/review/prepend/prepend.fix index 40ae248..7ba8c85 100644 --- a/data/review/prepend/prepend.fix +++ b/data/review/prepend/prepend.fix @@ -6,5 +6,9 @@ prepend("animals[].1", "Yeah ") prepend("bnimals[].*", "Muh ") +prepend("others[].1.name", "Hello ") + +prepend("OTHERS[].*.name", "Hi ") + # This results in error as expected: # prepend("ANIMALS[]", "Hmmm ") \ No newline at end of file diff --git a/data/review/prepend/result.json b/data/review/prepend/result.json index f630cf2..cc36c62 100644 --- a/data/review/prepend/result.json +++ b/data/review/prepend/result.json @@ -6,5 +6,13 @@ "name" : "Boss bird" }, "ANIMALS" : [ "dog", "cat", "zebra" ], + "others" : [ { + "animal" : "dog", + "name" : "Hello Jake" + } ], + "OTHERS" : [ { + "animal" : "dog", + "name" : "Hi Jake" + } ], "animal" : "What a nice bunny" }