summaryrefslogtreecommitdiff
path: root/ccan/tal/str/test/run-take.c
diff options
context:
space:
mode:
authorWilliam Casarin <jb55@jb55.com>2018-07-09 22:28:25 -0700
committerWilliam Casarin <jb55@jb55.com>2018-07-09 22:31:48 -0700
commit9593fc545950782ed75f12f53238b07885559b2b (patch)
tree9c7c2f7cbb427c54e9184cb61eedce737a6cbc6f /ccan/tal/str/test/run-take.c
parentbd8c223756d2f912526ecef53bae0cc8e0c63442 (diff)
remove ccan for now
Diffstat (limited to 'ccan/tal/str/test/run-take.c')
-rw-r--r--ccan/tal/str/test/run-take.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/ccan/tal/str/test/run-take.c b/ccan/tal/str/test/run-take.c
deleted file mode 100644
index edf173f..0000000
--- a/ccan/tal/str/test/run-take.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <ccan/tal/str/str.h>
-#include <ccan/tal/str/str.c>
-#include <ccan/tap/tap.h>
-#include "helper.h"
-
-int main(void)
-{
- char *parent, *c;
-
- plan_tests(14);
-
- parent = tal(NULL, char);
- ok1(parent);
-
- c = tal_strdup(parent, "hello");
-
- c = tal_strdup(parent, take(c));
- ok1(strcmp(c, "hello") == 0);
- ok1(tal_parent(c) == parent);
-
- c = tal_strndup(parent, take(c), 5);
- ok1(strcmp(c, "hello") == 0);
- ok1(tal_parent(c) == parent);
-
- c = tal_strndup(parent, take(c), 3);
- ok1(strcmp(c, "hel") == 0);
- ok1(tal_parent(c) == parent);
- tal_free(c);
-
- c = tal_strdup(parent, "hello %s");
- c = tal_fmt(parent, take(c), "there");
- ok1(strcmp(c, "hello there") == 0);
- ok1(tal_parent(c) == parent);
- /* No leftover allocations. */
- tal_free(c);
- ok1(no_children(parent));
-
- tal_free(parent);
- ok1(!taken_any());
-
- /* NULL pass-through. */
- c = NULL;
- ok1(tal_strdup(NULL, take(c)) == NULL);
- ok1(tal_strndup(NULL, take(c), 5) == NULL);
- ok1(tal_fmt(NULL, take(c), 0) == NULL);
-
- return exit_status();
-}