util.jsonpointer: Improve tests
authorKim Alvefur <zash@zash.se>
Wed, 19 Oct 2022 14:21:13 +0200
changeset 12781 4d5549de27e6
parent 12780 4715301a3504
child 12782 6163c8b17ea9
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.
spec/util_jsonpointer_spec.lua
--- a/spec/util_jsonpointer_spec.lua	Wed Oct 19 14:07:48 2022 +0200
+++ b/spec/util_jsonpointer_spec.lua	Wed Oct 19 14:21:13 2022 +0200
@@ -21,9 +21,11 @@
 		 }]])
 		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"));