Files
Stephan Renatus afdb285a06 wasm: fix remaining exceptions (mixed bag) (#3346)
* wasm-e2e: fix test runner, adapt and include jsonpatch tests

The `sort_bindings` key now is interpreted a little differently now: it's
no longer sorting and comparing, but building two sets and compares them.

From the test author's perspective, nothing has changed, except that it
now actually compares them.

Fixes #2949.

* exported tests: don't sort test expectations

This leads to very weird situations, and seems to only be a convenience
for the test authors. So, instead, we'll have the test authors pin down
whatever the sorted bindings are, and assert that the sorted bindings of
the returned result set match.

* wasm: fix regex.find_all_string_submatch_n with n != -1

Fixes #3352.

* wasm: unify objects that contain vars

Unification only happens by the reused existing code path, but we still
have to assert equality of the rest.

Fixes #3351.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2021-04-15 17:45:22 +02:00

68 lines
1.5 KiB
YAML

cases:
# Here are some tests that cover dealing with sets and json.patch, since that
# is not covered by the spec.
- note: jsonpatch/set
query: data.main.result.foo = x
want_result:
- x:
- a
- c
modules:
- |
package main
doc = {"foo": {"a", "b", "c"}}
patch = [{"op": "remove", "path": "foo/b"}]
result = r {r = json.patch(doc, patch)}
sort_bindings: true
- note: jsonpatch/set
query: data.main.result.foo = x
want_result:
- x:
- a
- b
- c
- d
modules:
- |
package main
doc = {"foo": {"a", "b", "c"}}
patch = [{"op": "add", "path": "foo/d", "value": "d"}]
result = r {r = json.patch(doc, patch)}
sort_bindings: true
- note: jsonpatch/set
query: data.main.result.foo = x
want_result: [] # value does not match key
modules:
- |
package main
doc = {"foo": {"a", "b", "c"}}
patch = [{"op": "add", "path": "foo/d", "value": "e"}]
result = r {r = json.patch(doc, patch)}
- note: jsonpatch/set
query: 'data.main.result.foo = x; data.main.result.bar = z'
want_result:
- x:
- b
z:
- a
- c
- d
modules:
- |
package main
doc = {"foo": {"a", "b"}, "bar": {"c", "d"}}
patch = [{"op": "move", "from": "foo/a", "path": "bar/a"}]
result = r {r = json.patch(doc, patch)}
sort_bindings: true
- note: jsonpatch/set
query: data.main.result = x
want_result:
- x:
- [1, 2]
modules:
- |
package main
doc = {[1]}
patch = [{"op": "add", "path": [[1], 1], "value": 2}]
result = r {r = json.patch(doc, patch)}