| 270 | } |
| 271 | |
| 272 | static void remove_first(void) |
| 273 | { |
| 274 | struct json *j = json_parse(tmpctx, "['one', 'two', 'three']"); |
| 275 | assert(j); |
| 276 | json_tok_remove(&j->toks, j->toks, j->toks + 1, 1); |
| 277 | assert(j->toks); |
| 278 | |
| 279 | test_toks(j, "two", "three", NULL); |
| 280 | assert(tal_count(j->toks) == 3); |
| 281 | |
| 282 | j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three'}"); |
| 283 | assert(j); |
| 284 | |
| 285 | json_tok_remove(&j->toks, j->toks, j->toks + 1, 1); |
| 286 | assert(j); |
| 287 | test_toks(j, "2", "two", "3", "three", NULL); |
| 288 | assert(tal_count(j->toks) == 5); |
| 289 | |
| 290 | j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three'}"); |
| 291 | json_tok_remove(&j->toks, j->toks, j->toks + 1, 1); |
| 292 | assert(j); |
| 293 | test_toks(j, "2", "two", "3", "three", NULL); |
| 294 | assert(tal_count(j->toks) == 5); |
| 295 | |
| 296 | } |
| 297 | |
| 298 | static void remove_last(void) |
| 299 | { |
no test coverage detected