Mercurial > prosody-hg
comparison 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 |
| parents | 5bf9056dca2c |
| children |
comparison
equal
deleted
inserted
replaced
| 12776:4715301a3504 | 12777:4d5549de27e6 |
|---|---|
| 19 " ": 7, | 19 " ": 7, |
| 20 "m~n": 8 | 20 "m~n": 8 |
| 21 }]]) | 21 }]]) |
| 22 end) | 22 end) |
| 23 it("works", function() | 23 it("works", function() |
| 24 assert.is_nil(jp.resolve("string", "/string")) | |
| 24 assert.same(example, jp.resolve(example, "")); | 25 assert.same(example, jp.resolve(example, "")); |
| 25 assert.same({ "bar", "baz" }, jp.resolve(example, "/foo")); | 26 assert.same({ "bar", "baz" }, jp.resolve(example, "/foo")); |
| 26 assert.same("bar", jp.resolve(example, "/foo/0")); | 27 assert.same("bar", jp.resolve(example, "/foo/0")); |
| 28 assert.same(nil, jp.resolve(example, "/foo/-")); | |
| 27 assert.same(0, jp.resolve(example, "/")); | 29 assert.same(0, jp.resolve(example, "/")); |
| 28 assert.same(1, jp.resolve(example, "/a~1b")); | 30 assert.same(1, jp.resolve(example, "/a~1b")); |
| 29 assert.same(2, jp.resolve(example, "/c%d")); | 31 assert.same(2, jp.resolve(example, "/c%d")); |
| 30 assert.same(3, jp.resolve(example, "/e^f")); | 32 assert.same(3, jp.resolve(example, "/e^f")); |
| 31 assert.same(4, jp.resolve(example, "/g|h")); | 33 assert.same(4, jp.resolve(example, "/g|h")); |
