Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vti
Created July 20, 2010 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vti/3fe4befaf06b8062860e to your computer and use it in GitHub Desktop.
Save vti/3fe4befaf06b8062860e to your computer and use it in GitHub Desktop.
diff --git a/t/mojo/dom.t b/t/mojo/dom.t
index f10def6..fad76db 100644
--- a/t/mojo/dom.t
+++ b/t/mojo/dom.t
@@ -7,7 +7,7 @@ use warnings;
use utf8;
-use Test::More tests => 128;
+use Test::More tests => 134;
# Homer gave me a kidney: it wasn't his, I didn't need it,
# and it came postage due- but I appreciated the gesture!
@@ -313,6 +313,52 @@ like($dom->at('[id="works"]')->text, qr/\[awesome\]\]/, 'right text');
is($dom->search('description')->[1]->text, '<p>trololololo>', 'right text');
is($dom->at('pubdate')->text, 'Mon, 12 Jul 2010 20:42:00', 'right text');
+# Yadis
+$dom->parse(<<'EOF');
+<?xml version="1.0" encoding="UTF-8"?>
+<XRDS xmlns="xri://$xrds">
+ <XRD xmlns="xri://$xrd*($v*2.0)">
+ <Service>
+ <Type> http://lid.netmesh.org/sso/2.0 </Type>
+ </Service>
+ <Service>
+ <Type> http://lid.netmesh.org/sso/1.0 </Type>
+ </Service>
+ </XRD>
+</XRDS>
+EOF
+my $services = $dom->search('xrds xrd service');
+is($services->[0]->at('type')->text, ' http://lid.netmesh.org/sso/2.0 ');
+is($services->[1]->at('type')->text, ' http://lid.netmesh.org/sso/1.0 ');
+
+# Yadis (with namespace)
+$dom->parse(<<'EOF');
+<?xml version="1.0" encoding="UTF-8"?>
+<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
+ <XRD>
+ <Service>
+ <Type> http://lid.netmesh.org/sso/3.0 </Type>
+ </Service>
+ <Service>
+ <Type> http://lid.netmesh.org/sso/4.0 </Type>
+ </Service>
+ </XRD>
+ <XRD>
+ <Service>
+ <Type> http://lid.netmesh.org/sso/2.0 </Type>
+ </Service>
+ <Service>
+ <Type> http://lid.netmesh.org/sso/1.0 </Type>
+ </Service>
+ </XRD>
+</xrds:XRDS>
+EOF
+$services = $dom->search('xrds xrd service');
+is($services->[0]->at('type')->text, ' http://lid.netmesh.org/sso/3.0 ');
+is($services->[1]->at('type')->text, ' http://lid.netmesh.org/sso/4.0 ');
+is($services->[2]->at('type')->text, ' http://lid.netmesh.org/sso/2.0 ');
+is($services->[3]->at('type')->text, ' http://lid.netmesh.org/sso/1.0 ');
+
# Result and iterator order
$dom->parse('<a><b>1</b></a><b>2</b><b>3</b>');
my @numbers;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment