1 #include <ccan/json_out/json_out.h>
2 /* Include the C files directly. */
3 #include <ccan/json_out/json_out.c>
4 #include <ccan/tap/tap.h>
6 static const char *ptr;
7 static bool called = false;
9 static void move_cb(struct json_out *jout, ptrdiff_t delta,
19 const tal_t *ctx = tal(NULL, char);
20 struct json_out *jout;
24 /* This is how many tests you plan to run */
27 /* Test nested arrays. */
28 jout = json_out_new(ctx);
29 json_out_call_on_move(jout, move_cb, jout);
31 json_out_start(jout, NULL, '{');
32 ptr = json_out_contents(jout, &len);
34 p = json_out_member_direct(jout, "fieldname", 102);
37 memset(p+1, 'p', 100);
39 json_out_finished(jout);
41 /* Contents should have moved correctly. */
42 ok1(json_out_contents(jout, &len) == ptr);
46 /* This exits depending on whether all tests passed */