summaryrefslogtreecommitdiff
path: root/src/test/test_parsecommon.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2018-10-12 15:48:38 +0300
committerrl1987 <rl1987@sdf.lonestar.org>2018-10-16 18:04:20 +0300
commit5c891dba770b752d16f7e7cea8f61f15abd09ef5 (patch)
treeafcd2dd21fc005d8a1cbeb8ad9403474b1c9e642 /src/test/test_parsecommon.c
parent7829e3a86875da16e3d7ac55be85145bd672fc12 (diff)
downloadtor-5c891dba770b752d16f7e7cea8f61f15abd09ef5.tar.gz
tor-5c891dba770b752d16f7e7cea8f61f15abd09ef5.zip
Test argument concatenation in get_next_token()
Diffstat (limited to 'src/test/test_parsecommon.c')
-rw-r--r--src/test/test_parsecommon.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/test_parsecommon.c b/src/test/test_parsecommon.c
index ba778d9969..b63327ecd1 100644
--- a/src/test/test_parsecommon.c
+++ b/src/test/test_parsecommon.c
@@ -60,12 +60,33 @@ test_parsecommon_get_next_token_success(void *arg)
return;
}
+static void
+test_parsecommon_get_next_token_concat_args(void *arg)
+{
+ memarea_t *area = memarea_new();
+ const char *str = "proto A=1 B=2";
+ const char *end = str + strlen(str);
+ const char **s = &str;
+ token_rule_t rule = T01("proto", K_PROTO, CONCAT_ARGS, NO_OBJ);
+ (void)arg;
+
+ directory_token_t *token = get_next_token(area, s, end, &rule);
+
+ tt_int_op(token->tp, OP_EQ, K_PROTO);
+ tt_int_op(token->n_args, OP_EQ, 1);
+ tt_str_op(*(token->args), OP_EQ, "A=1 B=2");
+
+ done:
+ memarea_drop_all(area);
+}
+
#define PARSECOMMON_TEST(name) \
{ #name, test_parsecommon_ ## name, 0, NULL, NULL }
struct testcase_t parsecommon_tests[] = {
PARSECOMMON_TEST(tokenize_string_null),
PARSECOMMON_TEST(get_next_token_success),
+ PARSECOMMON_TEST(get_next_token_concat_args),
END_OF_TESTCASES
};