Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Add test for prepend string array
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Feb 1, 2022
1 parent 9c224c3 commit d3ebe83
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
8 changes: 8 additions & 0 deletions data/testing/prependArrays_strings/animalsStrings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"animals":[
"dog",
"cat"
],
"others": "human",
"fictional": "unicorn"
}
10 changes: 10 additions & 0 deletions data/testing/prependArrays_strings/expected_string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"animals": [
"earthworm",
"unicorn",
"human",
"dog",
"cat"
],
"others": "human"
}
10 changes: 10 additions & 0 deletions data/testing/prependArrays_strings/result_string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"animals" : [ "dog", "cat", {
"$prepend" : "human"
}, {
"$prepend" : "unicorn"
}, {
"$prepend" : "earthworm"
} ],
"others" : "human"
}
5 changes: 5 additions & 0 deletions data/testing/prependArrays_strings/test_prepend_string.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
copy_field("others", "animals[].$prepend")

move_field("fictional", "animals[].$prepend")

add_field("animals[].$prepend", "earthworm")
10 changes: 10 additions & 0 deletions data/testing/prependArrays_strings/test_prepend_string.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
infile = FLUX_DIR + "animalsStrings.json";

infile
| open-file
| as-records
| decode-json
| fix(FLUX_DIR + "test_prepend_string.fix")
| encode-json(prettyPrinting="true")
| write(FLUX_DIR + "result_string.json")
;

0 comments on commit d3ebe83

Please sign in to comment.