| 279 | } |
| 280 | |
| 281 | static void remove_multiple(void) |
| 282 | { |
| 283 | struct json *j = json_parse(tmpctx, "['a', 'b', 'c', 'd', 'e']"); |
| 284 | json_tok_remove(&j->toks, j->toks, j->toks + 1, 2); |
| 285 | test_toks(j, "c", "d", "e", NULL); |
| 286 | |
| 287 | j = json_parse(tmpctx, "['a', 'b', 'c', 'd', 'e']"); |
| 288 | json_tok_remove(&j->toks, j->toks, j->toks + 2, 2); |
| 289 | test_toks(j, "a", "d", "e", NULL); |
| 290 | |
| 291 | j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three', '4':'four'}"); |
| 292 | json_tok_remove(&j->toks, j->toks, j->toks + 3, 2); |
| 293 | assert(j); |
| 294 | test_toks(j, "1", "one", "4", "four", NULL); |
| 295 | assert(tal_count(j->toks) == 5); |
| 296 | } |
| 297 | |
| 298 | static void remove_all(void) |
| 299 | { |
no test coverage detected