Skip to content

Commit

Permalink
More replacements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghislain Fourny committed Jul 10, 2024
1 parent bc94ae5 commit 831ed82
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(:JIQS: ShouldRun; Output="[ 9, 5, 7, 8, 6 ]" :)
variable $je := [1 to 4];
(delete json $je[[1]], delete json $je[[3]], replace value of json $je[[2]] with 5, replace json value of $je[[4]] with 6, insert json 7 into $je at position 4, insert json 8 into $je at position 4, insert json 9 into $je at position 1);
(delete json $je[[1]], delete json $je[[3]], replace value of json $je[[2]] with 5, replace value of json $je[[4]] with 6, insert json 7 into $je at position 4, insert json 8 into $je at position 4, insert json 9 into $je at position 1);
$je
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(:JIQS: ShouldCrash; ErrorCode="JNUP0009"; ErrorMetadata="LINE:3:COLUMN:1:" :)
variable $je := [1 to 4];
(replace value of json $je[[1]] with "foo", replace json value of $je[[1]] with "bar");
(replace value of json $je[[1]] with "foo", replace value of json $je[[1]] with "bar");
$je

(: replace at same array with same selector :)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(:JIQS: ShouldRun; Output="[ 9, 5, 7, 8, 6 ]" :)
copy $je := [1 to 4]
modify (delete json $je[[1]], delete json $je[[3]], replace value of json $je[[2]] with 5, replace json value of $je[[4]] with 6, insert json 7 into $je at position 4, insert json 8 into $je at position 4, insert json 9 into $je at position 1)
modify (delete json $je[[1]], delete json $je[[3]], replace value of json $je[[2]] with 5, replace value of json $je[[4]] with 6, insert json 7 into $je at position 4, insert json 8 into $je at position 4, insert json 9 into $je at position 1)
return $je
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(:JIQS: ShouldRun; Output="{ "a" : 4, "e" : 5, "g" : 6, "f" : 7 }" :)
copy $je := {"a": 1, "b": 2, "c": 3, "d": 4}
modify (insert json "e": 5 into $je, replace value of json $je.a with 4, rename json $je.b as "f", replace json value of $je.b with 7, delete json $je.c, delete json $je.d, insert json "g" : 6 into $je)
modify (insert json "e": 5 into $je, replace value of json $je.a with 4, rename json $je.b as "f", replace value of json $je.b with 7, delete json $je.c, delete json $je.d, insert json "g" : 6 into $je)
return $je
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(:JIQS: ShouldCrash; ErrorCode="JNUP0009"; ErrorMetadata="LINE:3:COLUMN:8:" :)
copy $je := { "a" : 1, "b" : 2, "c" : 3 }
modify (replace value of json $je.a with "foo", replace json value of $je.a with "bar")
modify (replace value of json $je.a with "foo", replace value of json $je.a with "bar")
return $je

(: replace at same object with same selector :)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(:JIQS: ShouldCrash; ErrorCode="JNUP0009"; ErrorMetadata="LINE:3:COLUMN:8:" :)
copy $je := [1 to 4]
modify (replace value of json $je[[1]] with "foo", replace json value of $je[[1]] with "bar")
modify (replace value of json $je[[1]] with "foo", replace value of json $je[[1]] with "bar")
return $je

(: replace at same array with same selector :)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(:JIQS: ShouldCrash; ErrorCode="XUST0001"; ErrorMetadata="LINE:3:COLUMN:7:" :)
copy $je := {"foo": "bar", "foobar": "barfoo"}
modify replace value of json $je.foo with (replace json value of $je.foo with "foo")
modify replace value of json $je.foo with (replace value of json $je.foo with "foo")
return $je

(: source expr is not simple :)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(:JIQS: ShouldCrash; ErrorCode="XUST0001"; ErrorMetadata="LINE:3:COLUMN:7:" :)
copy $je := {"foo": "bar", "foobar": "barfoo"}
modify replace value of json (replace json value of $je.foo with "foo").foo with "foo"
modify replace value of json (replace value of json $je.foo with "foo").foo with "foo"
return $je

(: target expr is not simple :)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(:JIQS: ShouldRun; Output="[ 1, 2, 5, 6 ]" :)
copy $je := [1 to 4]
modify (replace value of json $je[[3]] with 5, replace json value of $je[[4]] with 6)
modify (replace value of json $je[[3]] with 5, replace value of json $je[[4]] with 6)
return $je
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(:JIQS: ShouldRun; Output="{ "foobar" : "foobar", "foo" : "foo" }" :)
copy $je := {"foo": "bar", "foobar": "barfoo"}
modify (replace value of json $je.foo with "foo", replace json value of $je."foobar" with "foobar")
modify (replace value of json $je.foo with "foo", replace value of json $je."foobar" with "foobar")
return $je

0 comments on commit 831ed82

Please sign in to comment.