diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-08-12 16:07:29 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-08-12 16:07:29 +0100 |
commit | 9d3180655c79d9a557e57fab78de11ab13792ca3 (patch) | |
tree | 447f2484a75d182374721fd3302e090270604e2d /test | |
parent | 7c75e68788215e21bd88a6d581429df9bf8cfbaf (diff) | |
download | rspamd-9d3180655c79d9a557e57fab78de11ab13792ca3.tar.gz rspamd-9d3180655c79d9a557e57fab78de11ab13792ca3.zip |
Fix rcl test suite and parser.
Diffstat (limited to 'test')
-rw-r--r-- | test/rspamd_rcl_test.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/rspamd_rcl_test.c b/test/rspamd_rcl_test.c index 01b3ba835..695002de5 100644 --- a/test/rspamd_rcl_test.c +++ b/test/rspamd_rcl_test.c @@ -23,6 +23,7 @@ #include "../src/config.h" #include "../src/rcl/rcl.h" +#include "../src/main.h" #include "tests.h" const gchar *rcl_test_valid[] = { @@ -33,7 +34,7 @@ const gchar *rcl_test_valid[] = { "\"key1\": \"value;\"" "}\n", /* Nginx like */ - "section1 { param1 = value; param2 = value, param3 = [\"value1\", 100500]}\n" + "section1 { param1 = value; param2 = value, param3 = [\"value1\", value2, 100500]}\n" "section2 { param1 = {key = value}, param1 = [\"key\"]}", /* Numbers */ "key = 1s\n" @@ -57,6 +58,7 @@ rspamd_rcl_test_func (void) struct rspamd_cl_parser *parser; rspamd_cl_object_t *obj; const gchar **cur; + guchar *emitted; GError *err = NULL; cur = rcl_test_valid; @@ -65,6 +67,13 @@ rspamd_rcl_test_func (void) g_assert (parser != NULL); rspamd_cl_parser_add_chunk (parser, *cur, strlen (*cur), &err); g_assert_no_error (err); + obj = rspamd_cl_parser_get_object (parser, &err); + g_assert_no_error (err); + emitted = rspamd_cl_object_emit (obj, RSPAMD_CL_EMIT_JSON); + g_assert (emitted != NULL); + msg_info ("got json output: %s", emitted); + g_free (emitted); + rspamd_cl_parser_free (parser); cur ++; } |