Skip to content

Commit

Permalink
Add integration test for #278
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Jan 17, 2023
1 parent 0390880 commit d611014
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"GST" : [ {
"a" : "TestA1"
}, {
"a" : "TestB1",
"b" : "TestB2"
}, {
"a" : "TestC1",
"b" : "TestC2",
"c" : "TestC3"
} ],
"subject" : [ {
"name" : "Test",
"altLabel" : [ "TestA1", "TestB1 ( TestB2 )", "TestC1 ( TestC2 TestC3 )" ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"GST" : [
{
"a" : "TestA1"
}, {
"a" : "TestB1",
"b" : "TestB2"
}, {
"a" : "TestC1",
"b" : "TestC2",
"c" : "TestC3"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set_array("subject[]")
add_field("subject[].$append.name","Test")
set_array("subject[].$last.altLabel[]")

do list(path:"GST[]", "var": "$i") # Other altLabels have a "," character between $a and $b.
paste("subject[].$last.altLabel[].$append", "$i.a", "~(", "$i.b", "$i.c", "~)")
end

replace_all("subject[].*.altLabel[].*"," | \\( \\)","")
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,18 @@
{
"GST" : [ {
"a" : "TestA1"
}, {
"a" : "TestB1",
"b" : "TestB2"
}, {
"a" : "TestC1",
"b" : "TestC2",
"c" : "TestC3"
} ],
"subject" : [ {
"name" : "Test",
"agent" : {
"altLabel" : [ "TestA1", "TestB1 ( TestB2 )", "TestC1 ( TestC2 TestC3 )" ]
}
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"GST" : [
{
"a" : "TestA1"
}, {
"a" : "TestB1",
"b" : "TestB2"
}, {
"a" : "TestC1",
"b" : "TestC2",
"c" : "TestC3"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set_array("subject[]")
add_field("subject[].$append.name","Test")
set_array("subject[].$last.agent.altLabel[]")

do list(path:"GST[]", "var": "$i") # Other altLabels have a "," character between $a and $b.
paste("subject[].$last.agent.altLabel[].$append", "$i.a", "~(", "$i.b", "$i.c", "~)")
end

replace_all("subject[].*.agent.altLabel[].*"," | \\( \\)","")
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 #278

0 comments on commit d611014

Please sign in to comment.