aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_parsecommon.c
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2018-10-16 17:39:52 +0300
committerrl1987 <rl1987@sdf.lonestar.org>2018-10-16 18:04:54 +0300
commit7fd82a4570c4c3ea887c02190a54e424eb5f4c5f (patch)
treeaf0ad1b9c9d39ef344579dc4743dd3c6dfd88ad6 /src/test/test_parsecommon.c
parentf10d664fd14b318fba23c7290c800590d0a474b4 (diff)
downloadtor-7fd82a4570c4c3ea887c02190a54e424eb5f4c5f.tar.gz
tor-7fd82a4570c4c3ea887c02190a54e424eb5f4c5f.zip
One testcase for annotation handling in tokenize_string()
Diffstat (limited to 'src/test/test_parsecommon.c')
-rw-r--r--src/test/test_parsecommon.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/test_parsecommon.c b/src/test/test_parsecommon.c
index 13e4ac8c7f..7ce4b71b00 100644
--- a/src/test/test_parsecommon.c
+++ b/src/test/test_parsecommon.c
@@ -201,6 +201,33 @@ test_parsecommon_tokenize_string_at_end(void *arg)
}
static void
+test_parsecommon_tokenize_string_no_annotations(void *arg)
+{
+ memarea_t *area = memarea_new();
+ smartlist_t *tokens = smartlist_new();
+
+ (void)arg;
+
+ token_rule_t table[] = {
+ A01("@last-listed", A_LAST_LISTED, CONCAT_ARGS, NO_OBJ),
+ END_OF_TABLE,
+ };
+
+ char *str = tor_strdup("@last-listed 2018-09-21 15:30:03\n");
+
+ int retval =
+ tokenize_string(area, str, NULL, tokens, table, 0);
+
+ tt_int_op(retval, OP_EQ, -1);
+
+ done:
+ tor_free(str);
+ memarea_drop_all(area);
+ smartlist_free(tokens);
+ return;
+}
+
+static void
test_parsecommon_get_next_token_success(void *arg)
{
memarea_t *area = memarea_new();
@@ -550,6 +577,7 @@ struct testcase_t parsecommon_tests[] = {
PARSECOMMON_TEST(tokenize_string_max_cnt),
PARSECOMMON_TEST(tokenize_string_at_start),
PARSECOMMON_TEST(tokenize_string_at_end),
+ PARSECOMMON_TEST(tokenize_string_no_annotations),
PARSECOMMON_TEST(get_next_token_success),
PARSECOMMON_TEST(get_next_token_concat_args),
PARSECOMMON_TEST(get_next_token_parse_keys),