Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
Add test variant and fix tests #102
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Mar 22, 2022
1 parent f1a5b4f commit d199059
Show file tree
Hide file tree
Showing 25 changed files with 156 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"test" : [ "dog", "parrot", "human" ],
"test" : [ "dog", "parrot" ],
"animals" : [ {
"animal" : "dog",
"classification" : {
Expand All @@ -10,10 +10,5 @@
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"test" : [ "dog", "parrot", "human" ]
"test" : [ "dog", "parrot" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"test" : [ "dog", "parrot", "human" ],
"animals" : [ {
"animal" : "dog",
"classification" : {
"type" : "mammal"
}
}, {
"animal" : "parrot",
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"test" : [ "dog", "parrot", "human" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dog mammal
cat mammal
parrot bird
shark fish
dragon fictional animal
unicorn fictional animal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set_array("animals[]")
do list(path: "test[]", "var": "$f")
copy_field("$f", "animals[].$append.animal")
copy_field("$f", "animals[].$last.classification.type")
end

do list(path: "animals[]")
lookup("classification.type", "./mapfile.tsv", "sep_char":"\t")
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "input.json"
|open-file
|as-records
|decode-json
|fix(FLUX_DIR + "test.fix")
|encode-json(prettyPrinting="true")
|write(FLUX_DIR + "output-metafix.json")
;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See issue #149
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"test" : [ "dog", "parrot", "human" ],
"test" : [ "dog", "parrot" ],
"animals" : [ {
"animal" : "dog",
"classification" : {
Expand All @@ -10,10 +10,5 @@
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"test" : [ "dog", "parrot", "human" ]
"test" : [ "dog", "parrot" ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"animal" : "mammal"
}, {
"animal" : "bird"
}, {
"animal" : "human"
} ] } },
"animals" : [ {
"animal" : "dog",
Expand All @@ -18,10 +16,5 @@
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"real" :
{
"test" : [ { "animal" : "Jake" },
{ "animal" :"Blacky"},
{ "animal" : "Jens"} ]
{ "animal" :"Blacky"} ]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"metadata" : {
"real" : {
"test" : [ {
"animal" : "mammal"
}, {
"animal" : "bird"
}, {
"animal" : "human"
} ] } },
"animals" : [ {
"animal" : "dog",
"classification" : {
"type" : "mammal"
}
}, {
"animal" : "parrot",
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ "metadata" : {
"real" :
{
"test" : [ { "animal" : "Jake" },
{ "animal" :"Blacky"},
{ "animal" : "Jens"} ]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dog mammal
cat mammal
parrot bird
shark fish
dragon fictional animal
unicorn fictional animal
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Jake dog
Blacky parrot
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set_array("animals[]")
do list(path: "metadata.real.test[]", "var": "$f")
lookup("$f.animal", "./mapfile_2.tsv", "sep_char":"\t")
copy_field("$f.animal", "animals[].$append.animal")
copy_field("$f.animal", "animals[].$last.classification.type")
end

lookup("animals[].*.classification.type", "./mapfile.tsv", "sep_char":"\t")
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "input.json"
|open-file
|as-records
|decode-json
|fix(FLUX_DIR + "test.fix")
|encode-json(prettyPrinting="true")
|write(FLUX_DIR + "output-metafix.json")
;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See issue #149
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"test" : [ "dog", "parrot", "human" ],
"animals" : [ {
"animal" : "dog",
"classification" : {
"type" : "mammal"
}
}, {
"animal" : "parrot",
"classification" : {
"type" : "bird"
}
}, {
"animal" : "human",
"classification" : {
"type" : "human"
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"test" : [ "dog", "parrot", "human" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dog mammal
cat mammal
parrot bird
shark fish
dragon fictional animal
unicorn fictional animal
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set_array("animals[]")
do list(path: "test[]", "var": "$f")
copy_field("$f", "animals[].$append.animal")
copy_field("$f", "animals[].$last.classification.type")
end

lookup("animals[].*.classification.type", "./mapfile.tsv", "sep_char":"\t")
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FLUX_DIR + "input.json"
|open-file
|as-records
|decode-json
|fix(FLUX_DIR + "test.fix")
|encode-json(prettyPrinting="true")
|write(FLUX_DIR + "output-metafix.json")
;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
See issue #149

0 comments on commit d199059

Please sign in to comment.