tal: add tal_expand().
[ccan] / ccan / tal / test / run-named-nolabels.c
1 #define CCAN_TAL_NO_LABELS
2 #include <ccan/tal/tal.h>
3 #include <ccan/tal/tal.c>
4 #include <ccan/tap/tap.h>
5
6 int main(void)
7 {
8         int *p;
9         char name[] = "test name";
10
11         plan_tests(5);
12
13         p = tal(NULL, int);
14         ok1(tal_name(p) == NULL);
15
16         tal_set_name(p, "some literal");
17         ok1(strcmp(tal_name(p), "some literal") == 0);
18
19         tal_set_name(p, name);
20         ok1(strcmp(tal_name(p), name) == 0);
21         /* You can't reuse my pointer though! */
22         ok1(tal_name(p) != name);
23
24         tal_set_name(p, "some other literal");
25         ok1(strcmp(tal_name(p), "some other literal") == 0);
26
27         tal_free(p);
28
29         return exit_status();
30 }