aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-10-19 14:21:13 +0200
committerKim Alvefur <zash@zash.se>2022-10-19 14:21:13 +0200
commit5bf6e7f501cb572b913e31c29780056c2bb9dccd (patch)
treea414e5bf3f75819f37a70b54b7e91d0aa43fa2ae
parent7be6630dfe1f828603b455279b69947edda40c4c (diff)
downloadprosody-5bf6e7f501cb572b913e31c29780056c2bb9dccd.tar.gz
prosody-5bf6e7f501cb572b913e31c29780056c2bb9dccd.zip
util.jsonpointer: Improve tests
Result of mutation testing Remaining mutants are mostly relating to the math.type() fallback. Another case being that array[#array+1] == array[#array+2] and thus doesn't matter.
-rw-r--r--spec/util_jsonpointer_spec.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/spec/util_jsonpointer_spec.lua b/spec/util_jsonpointer_spec.lua
index ce07c7a1..75122296 100644
--- a/spec/util_jsonpointer_spec.lua
+++ b/spec/util_jsonpointer_spec.lua
@@ -21,9 +21,11 @@ describe("util.jsonpointer", function()
}]])
end)
it("works", function()
+ assert.is_nil(jp.resolve("string", "/string"))
assert.same(example, jp.resolve(example, ""));
assert.same({ "bar", "baz" }, jp.resolve(example, "/foo"));
assert.same("bar", jp.resolve(example, "/foo/0"));
+ assert.same(nil, jp.resolve(example, "/foo/-"));
assert.same(0, jp.resolve(example, "/"));
assert.same(1, jp.resolve(example, "/a~1b"));
assert.same(2, jp.resolve(example, "/c%d"));