diff options
author | Antti Ajanki <antti.ajanki@iki.fi> | 2013-08-06 16:21:26 +0300 |
---|---|---|
committer | Antti Ajanki <antti.ajanki@iki.fi> | 2013-08-06 16:21:26 +0300 |
commit | 1ea55bb8190e782940ff893ac8d492acabbbc886 (patch) | |
tree | c7e986e1f26abf4590ee523979ced5aff2d1c2cb /tests/linkextractor_tests.c | |
parent | cdec30061f66f8fea2df8629ef892f9a32d4d23c (diff) | |
download | vdr-plugin-webvideo-1ea55bb8190e782940ff893ac8d492acabbbc886.tar.gz vdr-plugin-webvideo-1ea55bb8190e782940ff893ac8d492acabbbc886.tar.bz2 |
Show title attribute of <a> when present
Diffstat (limited to 'tests/linkextractor_tests.c')
-rw-r--r-- | tests/linkextractor_tests.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/linkextractor_tests.c b/tests/linkextractor_tests.c index 2aa9166..60deba0 100644 --- a/tests/linkextractor_tests.c +++ b/tests/linkextractor_tests.c @@ -38,6 +38,12 @@ "<a href=\"" HTML5_HREF "\"><span><b> Test</b></span> <span>link</span></a>" \ "</body></html>" +#define HTML6_HREF "http://example.com/test/link" +#define HTML6_TITLE "Test link" +#define HTML6 "<html><body>" \ + "<a href=\"" HTML6_HREF "\" title=\"" HTML6_TITLE "\">ignored</a>" \ + "</body></html>" + void link_extractor_fixture_setup(LinkExtractorFixture *fixture, gconstpointer test_data) { @@ -152,7 +158,20 @@ void test_link_extractor_html_title(LinkExtractorFixture *fixture, g_ptr_array_free(links, TRUE); } -void test_link_extractor_xml(LinkExtractorFixture *fixture, - gconstpointer test_data) { - +void test_link_extractor_title_overrides_content( + LinkExtractorFixture *fixture, G_GNUC_UNUSED gconstpointer test_data) +{ + GPtrArray *links; + link_extractor_append(fixture->extractor, HTML6, strlen(HTML6)); + links = link_extractor_get_links(fixture->extractor); + g_assert(links); + g_assert(links->len == 1); + const struct Link *link = g_ptr_array_index(links, 0); + const char *href = link_get_href(link); + g_assert(href); + g_assert(strcmp(href, HTML6_HREF) == 0); + const char *title = link_get_title(link); + g_assert(title); + g_assert(strcmp(title, HTML6_TITLE) == 0); + g_ptr_array_free(links, TRUE); } |