| 239 | } |
| 240 | |
| 241 | static void remove_first(void) |
| 242 | { |
| 243 | struct json *j = json_parse(tmpctx, "['one', 'two', 'three']"); |
| 244 | assert(j); |
| 245 | json_tok_remove(&j->toks, j->toks, j->toks + 1, 1); |
| 246 | assert(j->toks); |
| 247 | |
| 248 | test_toks(j, "two", "three", NULL); |
| 249 | assert(tal_count(j->toks) == 3); |
| 250 | |
| 251 | j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three'}"); |
| 252 | assert(j); |
| 253 | |
| 254 | json_tok_remove(&j->toks, j->toks, j->toks + 1, 1); |
| 255 | assert(j); |
| 256 | test_toks(j, "2", "two", "3", "three", NULL); |
| 257 | assert(tal_count(j->toks) == 5); |
| 258 | |
| 259 | j = json_parse(tmpctx, "{'1':'one', '2':'two', '3':'three'}"); |
| 260 | json_tok_remove(&j->toks, j->toks, j->toks + 1, 1); |
| 261 | assert(j); |
| 262 | test_toks(j, "2", "two", "3", "three", NULL); |
| 263 | assert(tal_count(j->toks) == 5); |
| 264 | |
| 265 | } |
| 266 | |
| 267 | static void remove_last(void) |
| 268 | { |
no test coverage detected