Diff

spec/util_jsonpointer_spec.lua @ 12777:4d5549de27e6

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.
author Kim Alvefur <zash@zash.se>
date Wed, 19 Oct 2022 14:21:13 +0200
parent 12495:5bf9056dca2c
line wrap: on
line diff
--- 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"));