MCPcopy Create free account
hub / github.com/ElementsProject/lightning / remove_first

Function remove_first

common/test/run-json_remove.c:241–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241static 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
267static void remove_last(void)
268{

Callers 1

mainFunction · 0.85

Calls 3

json_tok_removeFunction · 0.85
test_toksFunction · 0.85
json_parseFunction · 0.70

Tested by

no test coverage detected