Test ast_xml_escape.
More...
Go to the source code of this file.
|
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Skeleton (sample) Test" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static const struct ast_module_info * | ast_module_info = &__mod_info |
|
static enum ast_test_result_state | test_res = AST_TEST_PASS |
|
Test ast_xml_escape.
- Author
David M. Lee, II <[email protected]>
Definition in file test_xml_escape.c.
◆ __reg_module()
static void __reg_module |
( |
void |
| ) |
|
|
static |
◆ __unreg_module()
static void __unreg_module |
( |
void |
| ) |
|
|
static |
◆ AST_MODULE_SELF_SYM()
◆ AST_TEST_DEFINE()
AST_TEST_DEFINE |
( |
xml_escape_test |
| ) |
|
Definition at line 62 of file test_xml_escape.c.
References AST_TEST_NOT_RUN, AST_TEST_PASS, sip_to_pjsip::info(), input(), TEST_EXECUTE, TEST_INIT, test_res, and test_xml().
69 info->name =
"xml_escape_test";
70 info->category =
"/main/xml_escape/";
71 info->summary =
"Test XML escaping";
82 input =
"encode me: <&>'\"";
83 expected =
"encode me: <&>'"";
92 input =
"<truncated>";
93 expected =
"<trunc";
static int input(yyscan_t yyscanner)
static enum ast_test_result_state test_res
static void test_xml(struct ast_test *test, const char *input, const char *expected, int max_len, int expected_res)
◆ load_module()
static int load_module |
( |
void |
| ) |
|
|
static |
◆ test_xml()
static void test_xml |
( |
struct ast_test * |
test, |
|
|
const char * |
input, |
|
|
const char * |
expected, |
|
|
int |
max_len, |
|
|
int |
expected_res |
|
) |
| |
|
static |
Definition at line 41 of file test_xml_escape.c.
References AST_TEST_FAIL, ast_test_status_update, ast_xml_escape(), and test_res.
Referenced by AST_TEST_DEFINE().
43 char actual[256] =
"";
47 max_len =
sizeof(actual);
51 if (res != expected_res) {
56 if (strcmp(expected, actual) != 0) {
static int input(yyscan_t yyscanner)
int ast_xml_escape(const char *string, char *outbuf, size_t buflen)
Escape reserved characters for use in XML.
#define ast_test_status_update(a, b, c...)
static enum ast_test_result_state test_res
◆ unload_module()
static int unload_module |
( |
void |
| ) |
|
|
static |
◆ __mod_info
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Skeleton (sample) Test" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
|
static |
◆ ast_module_info
◆ test_res