diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-08-13 01:01:06 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-08-13 01:01:06 +0100 |
commit | 409f5abe9ac2627c6e17cddb2cf0703960d6b5e5 (patch) | |
tree | a282989a8a238886c491f89530d184cf5fea935e | |
parent | 5e4d58a12e3b4c4fa97fe47195d61022784d02b2 (diff) | |
download | rspamd-409f5abe9ac2627c6e17cddb2cf0703960d6b5e5.tar.gz rspamd-409f5abe9ac2627c6e17cddb2cf0703960d6b5e5.zip |
Improve testing logic.
-rw-r--r-- | test/rspamd_rcl_test.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/rspamd_rcl_test.c b/test/rspamd_rcl_test.c index 695002de5..827153077 100644 --- a/test/rspamd_rcl_test.c +++ b/test/rspamd_rcl_test.c @@ -55,7 +55,7 @@ const gchar *rcl_test_valid[] = { void rspamd_rcl_test_func (void) { - struct rspamd_cl_parser *parser; + struct rspamd_cl_parser *parser, *parser2; rspamd_cl_object_t *obj; const gchar **cur; guchar *emitted; @@ -69,10 +69,38 @@ rspamd_rcl_test_func (void) g_assert_no_error (err); obj = rspamd_cl_parser_get_object (parser, &err); g_assert_no_error (err); + /* Test config emitting */ + emitted = rspamd_cl_object_emit (obj, RSPAMD_CL_EMIT_CONFIG); + g_assert (emitted != NULL); + msg_info ("got config output: %s", emitted); + parser2 = rspamd_cl_parser_new (); + g_assert (parser2 != NULL); + rspamd_cl_parser_add_chunk (parser2, emitted, strlen (emitted), &err); + g_assert_no_error (err); + rspamd_cl_parser_free (parser2); + g_free (emitted); + /* Test json emitted */ emitted = rspamd_cl_object_emit (obj, RSPAMD_CL_EMIT_JSON); g_assert (emitted != NULL); msg_info ("got json output: %s", emitted); + parser2 = rspamd_cl_parser_new (); + g_assert (parser2 != NULL); + rspamd_cl_parser_add_chunk (parser2, emitted, strlen (emitted), &err); + g_assert_no_error (err); + rspamd_cl_parser_free (parser2); g_free (emitted); + /* Compact json */ + emitted = rspamd_cl_object_emit (obj, RSPAMD_CL_EMIT_JSON_COMPACT); + g_assert (emitted != NULL); + msg_info ("got json compacted output: %s", emitted); + parser2 = rspamd_cl_parser_new (); + g_assert (parser2 != NULL); + rspamd_cl_parser_add_chunk (parser2, emitted, strlen (emitted), &err); + g_assert_no_error (err); + rspamd_cl_parser_free (parser2); + g_free (emitted); + + /* Cleanup */ rspamd_cl_parser_free (parser); cur ++; } |