[totem-pl-parser] tests: Add test for broken XSPF parsing



commit 487d2dafc45363e0174c86fbb2ca071ceb558b6d
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Oct 29 11:37:58 2012 +0100

    tests: Add test for broken XSPF parsing
    
    We don't handle xml:base correctly.

 plparse/tests/Makefile.am   |    3 ++-
 plparse/tests/parser.c      |   13 +++++++++++++
 plparse/tests/xml-base.xspf |    8 ++++++++
 3 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/plparse/tests/Makefile.am b/plparse/tests/Makefile.am
index ba07910..5232897 100644
--- a/plparse/tests/Makefile.am
+++ b/plparse/tests/Makefile.am
@@ -72,6 +72,7 @@ EXTRA_DIST =			\
 	rss.xml			\
 	dont-ignore-mp2t.ts	\
 	empty-feed.xml		\
-	no-url-podcast.xml
+	no-url-podcast.xml	\
+	xml-base.xspf
 
 -include $(top_srcdir)/git.mk
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index 48882f9..5a32b85 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -522,6 +522,18 @@ test_parsing_xspf_escaping (void)
 }
 
 static void
+test_parsing_xspf_xml_base (void)
+{
+	char *uri;
+	uri = get_relative_uri (TEST_SRCDIR "xml-base.xspf");
+	/* FIXME: The URL is incorrect here as we're not on HTTP, but
+	 * the parsing is incorrect as well, as we ignore xml:base:
+	 * http://wiki.xiph.org/index.php/XSPF_v1_Notes_and_Errata#xml:base */
+	g_assert_cmpstr (parser_test_get_entry_field (uri, TOTEM_PL_PARSER_FIELD_URI), ==, "http://example.org/three/four";);
+	g_free (uri);
+}
+
+static void
 test_smi_starttime (void)
 {
 	char *uri;
@@ -1148,6 +1160,7 @@ main (int argc, char *argv[])
 		g_test_add_func ("/parser/parsing/num_items_in_pls", test_parsing_num_entries);
 		g_test_add_func ("/parser/parsing/xspf_genre", test_parsing_xspf_genre);
 		g_test_add_func ("/parser/parsing/xspf_escaping", test_parsing_xspf_escaping);
+/*		g_test_add_func ("/parser/parsing/xspf_xml_base", test_parsing_xspf_xml_base); */
 		g_test_add_func ("/parser/parsing/itms_link", test_itms_parsing);
 		g_test_add_func ("/parser/parsing/lastfm-attributes", test_lastfm_parsing);
 		g_test_add_func ("/parser/parsing/m3u_separator", test_m3u_separator);
diff --git a/plparse/tests/xml-base.xspf b/plparse/tests/xml-base.xspf
new file mode 100644
index 0000000..04e7140
--- /dev/null
+++ b/plparse/tests/xml-base.xspf
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<playlist version="1" xmlns="http://xspf.org/ns/0/"; xml:base="one/">
+	<trackList xml:base="two/">
+		<track xml:base="../../three/">
+			<location>four</location>
+		</track>
+	</trackList>
+</playlist>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]