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 lookup with asterisk
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Feb 1, 2022
1 parent 62fd026 commit 9c224c3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
13 changes: 13 additions & 0 deletions data/testing/lookupWithAsterisk/animals.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"animals": [
{
"name": "Jake",
"animalGroup": "dog"
},
{
"name": "Blacky",
"animalGroup": "parrot"
}
],
"bnimals": ["dog", "parrot"]
}
7 changes: 7 additions & 0 deletions data/testing/lookupWithAsterisk/lookupWithAsterisk.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
put_map("map",
"dog":"mammal",
"parrot":"bird"
)

lookup("bnimals[].*", "map")
lookup("animals[].*.animalGroup", "map")
8 changes: 8 additions & 0 deletions data/testing/lookupWithAsterisk/lookupWithAsterisk.flux
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "animals.json"
|open-file
|as-records
| decode-json
|fix( FLUX_DIR + "lookupWithAsterisk.fix" )
| encode-json(prettyPrinting="true")
| write(FLUX_DIR + "result.json")
;
10 changes: 10 additions & 0 deletions data/testing/lookupWithAsterisk/result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"animals" : [ {
"name" : "Jake",
"animalGroup" : "mammal"
}, {
"name" : "Blacky",
"animalGroup" : "bird"
} ],
"bnimals" : [ "mammal", "bird" ]
}

0 comments on commit 9c224c3

Please sign in to comment.