extern char *qs_get_size_attr(Doc *doc, Node *tag, apr_pool_t *pool);
extern char *qs_get_accesskey_attr(Doc *doc, Node *tag, apr_pool_t *pool);
extern char *qs_get_istyle_attr(Doc *doc, Node *tag, apr_pool_t *pool);
-extern char* qs_get_maxlength_attr(Doc *doc, Node *tag, apr_pool_t *pool);
+extern char *qs_get_maxlength_attr(Doc *doc, Node *tag, apr_pool_t *pool);
extern int qs_is_checked_checkbox_attr(Doc *doc, Node *tag, apr_pool_t *pool);
extern int chxj_chxjif_is_mine(device_table *spec, Doc *doc, Node *tag);
extern char *qs_get_destlang_attr(Doc *doc, Node *tag, apr_pool_t *pool);
-extern char* qs_get_parse_attr(
- Doc* doc,
- Node* tag,
- request_rec* r);
+extern char *qs_get_parse_attr(Doc *doc, Node *tag, apr_pool_t *pool);
#endif
/*
* destination is specified.
* @param tag [i] The tag node to want to acquire the DESTLANG attribute
* is specified.
- * @param r [i] To use POOL.
+ * @param pool [i] To use POOL.
* @return The value of the DESTLANG attribute is returned. NULL is
* returned when not is.
*/
* @param doc [i] The pointer to the Doc structure to be scanned is
* specified.
* @param tag [i] The tag node to be scanned is specified.
- * @param r [i] To use POOL, the pointer to request_rec is specified.
+ * @param pool [i] To use POOL.
* @return The value of the PARSE attribute is returned. NULL is returned when
* not found.
*/
char *
-qs_get_parse_attr(Doc *doc, Node *tag, request_rec *r)
+qs_get_parse_attr(Doc *doc, Node *tag, apr_pool_t *pool)
{
Attr *attr;
/*--------------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/* The VALUE attribute was found. */
/*----------------------------------------------------------------------*/
- return apr_pstrdup(r->pool, value);
+ return apr_pstrdup(pool, value);
}
}
void test_qs_get_destlang_attr_002();
void test_qs_get_destlang_attr_003();
void test_qs_get_destlang_attr_004();
+/*==========================================================================*/
+/* qs_get_parse_attr */
+/*==========================================================================*/
+void test_qs_get_parse_attr_001();
+void test_qs_get_parse_attr_002();
+void test_qs_get_parse_attr_003();
+void test_qs_get_parse_attr_004();
/* pend */
void test_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...)
CU_add_test(str_util_suite, "qs_get_destlang_attr() 002", test_qs_get_destlang_attr_002);
CU_add_test(str_util_suite, "qs_get_destlang_attr() 003", test_qs_get_destlang_attr_003);
CU_add_test(str_util_suite, "qs_get_destlang_attr() 004", test_qs_get_destlang_attr_004);
+ /*========================================================================*/
+ /* qs_get_parse_attr */
+ /*========================================================================*/
+ CU_add_test(str_util_suite, "qs_get_parse_attr() 001", test_qs_get_parse_attr_001);
+ CU_add_test(str_util_suite, "qs_get_parse_attr() 002", test_qs_get_parse_attr_002);
+ CU_add_test(str_util_suite, "qs_get_parse_attr() 003", test_qs_get_parse_attr_003);
+ CU_add_test(str_util_suite, "qs_get_parse_attr() 004", test_qs_get_parse_attr_004);
/* aend */
CU_basic_run_tests();
#undef RESULT_STRING
#undef TEST_STRING
}
+/*==========================================================================*/
+/* qs_get_parse_attr */
+/*==========================================================================*/
+void test_qs_get_parse_attr_001()
+{
+#define TEST_STRING "<input parse=\"abc\">"
+#define RESULT_STRING "abc"
+ Node *node;
+ char *ret;
+ APR_INIT;
+
+ node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING));
+ ret = qs_get_parse_attr(&doc, node->child, p);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(ret, RESULT_STRING) == 0);
+
+ APR_TERM;
+#undef RESULT_STRING
+#undef TEST_STRING
+}
+void test_qs_get_parse_attr_002()
+{
+#define TEST_STRING "<input parse=\"\">"
+#define RESULT_STRING ""
+ Node *node;
+ char *ret;
+ APR_INIT;
+
+ node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING));
+ ret = qs_get_parse_attr(&doc, node->child, p);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(ret, RESULT_STRING) == 0);
+
+ APR_TERM;
+#undef RESULT_STRING
+#undef TEST_STRING
+}
+void test_qs_get_parse_attr_003()
+{
+#define TEST_STRING "<input parse>"
+#define RESULT_STRING ""
+ Node *node;
+ char *ret;
+ APR_INIT;
+
+ node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING));
+ ret = qs_get_parse_attr(&doc, node->child, p);
+ CU_ASSERT(ret != NULL);
+ CU_ASSERT(strcmp(ret, RESULT_STRING) == 0);
+
+ APR_TERM;
+#undef RESULT_STRING
+#undef TEST_STRING
+}
+void test_qs_get_parse_attr_004()
+{
+#define TEST_STRING "<input>"
+#define RESULT_STRING ""
+ Node *node;
+ char *ret;
+ APR_INIT;
+
+ node = qs_parse_string(&doc, TEST_STRING, sizeof(TEST_STRING));
+ ret = qs_get_parse_attr(&doc, node->child, p);
+ CU_ASSERT(ret == NULL);
+
+ APR_TERM;
+#undef RESULT_STRING
+#undef TEST_STRING
+}
/*
* vim:ts=2 et
*/