summaryrefslogtreecommitdiff
path: root/api_test
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2014-11-20 15:17:33 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2014-11-22 16:08:32 +0100
commit32be14c39f67eedf356adc4f673b66479b717c7c (patch)
treefa33fca26fb0ef02a708fc9cca89acf85cb183dc /api_test
parent759e03748a368be8b209dfd113441c05e1a5dcc0 (diff)
Set defaults for new headers and lists
Diffstat (limited to 'api_test')
-rw-r--r--api_test/main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/api_test/main.c b/api_test/main.c
index e17beda..933a4bd 100644
--- a/api_test/main.c
+++ b/api_test/main.c
@@ -37,6 +37,40 @@ test_content(test_batch_runner *runner, cmark_node_type type,
int allowed_content);
static void
+constructor(test_batch_runner *runner)
+{
+ for (int i = 0; i < num_node_types; ++i) {
+ cmark_node_type type = node_types[i];
+ cmark_node *node = cmark_node_new(type);
+ OK(runner, node != NULL, "new type %d", type);
+
+ switch (node->type) {
+ case CMARK_NODE_ATX_HEADER:
+ case CMARK_NODE_SETEXT_HEADER:
+ INT_EQ(runner, cmark_node_get_header_level(node), 1,
+ "default header level is 1");
+ node->as.header.level = 1;
+ break;
+
+ case CMARK_NODE_LIST:
+ INT_EQ(runner, cmark_node_get_list_type(node),
+ CMARK_BULLET_LIST,
+ "default is list type is bullet");
+ INT_EQ(runner, cmark_node_get_list_start(node), 1,
+ "default is list start is 1");
+ INT_EQ(runner, cmark_node_get_list_tight(node), 0,
+ "default is list is loose");
+ break;
+
+ default:
+ break;
+ }
+
+ cmark_node_destroy(node);
+ }
+}
+
+static void
accessors(test_batch_runner *runner)
{
static const unsigned char markdown[] =
@@ -398,6 +432,7 @@ int main() {
int retval;
test_batch_runner *runner = test_batch_runner_new();
+ constructor(runner);
accessors(runner);
create_tree(runner);
hierarchy(runner);