summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-self-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'libappstream-glib/as-self-test.c')
-rw-r--r--libappstream-glib/as-self-test.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index 11b51b6..aade35c 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -2870,6 +2870,15 @@ as_test_node_xml_func (void)
"It now also supports <em>em</em> and <code>code</code> tags."
"</p>"
"</description>";
+ const gchar *valid_em_code_2 = "<description>"
+ "<p><em>Emphasis</em> at the start of the paragraph</p>"
+ "</description>";
+ const gchar *valid_em_code_empty = "<description>"
+ "<p><em></em></p>"
+ "</description>";
+ const gchar *valid_em_code_empty_2 = "<description>"
+ "<p>empty <em></em> emphasis</p>"
+ "</description>";
GError *error = NULL;
AsNode *n2;
AsNode *root;
@@ -2940,8 +2949,34 @@ as_test_node_xml_func (void)
n2 = as_node_find (root, "description/p");
g_assert (n2 != NULL);
- printf ("<%s>\n", as_node_get_data (n2));
- g_assert_cmpstr (as_node_get_data (n2), ==, "It now also supports<em>em</em> and <code>code</code> tags.");
+ g_assert_cmpstr (as_node_get_data (n2), ==, "It now also supports <em>em</em> and <code>code</code> tags.");
+ as_node_unref (root);
+
+ root = as_node_from_xml (valid_em_code_2, 0, &error);
+ g_assert_no_error (error);
+ g_assert (root != NULL);
+
+ n2 = as_node_find (root, "description/p");
+ g_assert (n2 != NULL);
+ g_assert_cmpstr (as_node_get_data (n2), ==, "<em>Emphasis</em> at the start of the paragraph");
+ as_node_unref (root);
+
+ root = as_node_from_xml (valid_em_code_empty, 0, &error);
+ g_assert_no_error (error);
+ g_assert (root != NULL);
+
+ n2 = as_node_find (root, "description/p");
+ g_assert (n2 != NULL);
+ g_assert_cmpstr (as_node_get_data (n2), ==, NULL);
+ as_node_unref (root);
+
+ root = as_node_from_xml (valid_em_code_empty_2, 0, &error);
+ g_assert_no_error (error);
+ g_assert (root != NULL);
+
+ n2 = as_node_find (root, "description/p");
+ g_assert (n2 != NULL);
+ g_assert_cmpstr (as_node_get_data (n2), ==, "empty emphasis");
as_node_unref (root);
/* keep comments */