Skip to content

Commit

Permalink
Add tests for metamorph wildcard support in fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Dec 22, 2021
1 parent ec57786 commit 97c8fd2
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 0 deletions.
6 changes: 6 additions & 0 deletions data/experimental/wildCardTest/animals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"animal": "dog",
"bnimal": "cat",
"cnimal": "zebra",
"dnimol": "bunny"
}
3 changes: 3 additions & 0 deletions data/experimental/wildCardTest/animals_records.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"animal": "dog"}
{"bnimal": "cat"}
{"cnimal": "zebra"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
copy_field("*al", "stringimals[].$append")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
copy_field("[ac]nimal", "stringimals[].$append")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
copy_field("?ni??l", "stringimals[].$append")
1 change: 1 addition & 0 deletions data/experimental/wildCardTest/appendWithWildcard.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
copy_field("?nimal", "stringimals[].$append")
1 change: 1 addition & 0 deletions data/experimental/wildCardTest/simpleCopyWithWildcard.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
copy_field("?nimal", "animal")
10 changes: 10 additions & 0 deletions data/experimental/wildCardTest/wildcard_test1.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
infile = FLUX_DIR + "animals.json";

infile
| open-file
| as-records
| decode-json
| fix(FLUX_DIR + "appendWithWildcard.fix")
| encode-json(prettyPrinting="true")
| print
;
10 changes: 10 additions & 0 deletions data/experimental/wildCardTest/wildcard_test2.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
infile = FLUX_DIR + "animals_records.json";

infile
| open-file
| as-lines
| decode-json
| fix(FLUX_DIR + "simpleCopyWithWildcard.fix")
| encode-json(prettyPrinting="true")
| print
;
10 changes: 10 additions & 0 deletions data/experimental/wildCardTest/wildcard_test3.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
infile = FLUX_DIR + "animals.json";

infile
| open-file
| as-records
| decode-json
| fix(FLUX_DIR + "appendWithMultipleWildcards.fix")
| encode-json(prettyPrinting="true")
| print
;
10 changes: 10 additions & 0 deletions data/experimental/wildCardTest/wildcard_test4.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
infile = FLUX_DIR + "animals.json";

infile
| open-file
| as-records
| decode-json
| fix(FLUX_DIR + "appendWithAsteriksWildcard.fix")
| encode-json(prettyPrinting="true")
| print
;
10 changes: 10 additions & 0 deletions data/experimental/wildCardTest/wildcard_test5.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
infile = FLUX_DIR + "animals.json";

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

0 comments on commit 97c8fd2

Please sign in to comment.