Skip to content

Commit

Permalink
Merge pull request #48 from atoomic/gh-45-relative-links
Browse files Browse the repository at this point in the history
Add a unit test for relative links
  • Loading branch information
davorg authored Jan 12, 2019
2 parents 15ba6c5 + 2b3178e commit 35c40c2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ t/28-rss-guid.t
t/29-date-parsing.t
t/pod-coverage.t
t/pod.t
t/relative-links.t
t/samples/atom-10-example.xml
t/samples/atom-enclosure.xml
t/samples/atom-full.xml
Expand Down
48 changes: 48 additions & 0 deletions t/relative-links.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use strict;
use warnings;

use Test::More;
use XML::Feed;

my $content;
{
local $/;
$content = <DATA>;
}

my $feed = XML::Feed->parse( \$content );
my @links = map { $_->link } $feed->entries;

# RT 53661 - GH #45
is_deeply( \@links, ['/earthquakes/recenteqsww/Quakes/us2010rkb8.php'] )
or diag explain \@links;

done_testing;

__DATA__
<?xml version="1.0"?>
<feed xml:base="http://earthquake.usgs.gov/"
xmlns="http://www.w3.org/2005/Atom"
xmlns:georss="http://www.georss.org/georss">
<updated>2010-01-13T17:24:37Z</updated>
<title>USGS M5+ Earthquakes</title>
<subtitle>Real-time, worldwide earthquake list for the past 7
days</subtitle>
<link rel="self" href="/earthquakes/catalogs/7day-M5.xml"/>
<link href="http://earthquake.usgs.gov/earthquakes/"/>
<author><name>U.S. Geological Survey</name></author>
<id>http://earthquake.usgs.gov/</id>
<icon>/favicon.ico</icon>
<entry><id>urn:earthquake-usgs-gov:us:2010rkb8</id><title>M 5.3,
Tonga</title><updated>2010-01-13T16:21:24Z</updated><link
rel="alternate" type="text/html"
href="/earthquakes/recenteqsww/Quakes/us2010rkb8.php"/><summary
type="html"><![CDATA[<img
src="http://earthquake.usgs.gov/images/globes/-15_-175.jpg"
alt="15.741&#176;S 174.695&#176;W" align="left" hspace="20"
/><p>Wednesday, January 13, 2010 16:21:24 UTC<br>Thursday, January 14,
2010 06:21:24 AM at epicenter</p><p><strong>Depth</strong>: 10.00 km
(6.21 mi)</p>]]></summary><georss:point>-15.7409
-174.6951</georss:point><georss:elev>-10000</georss:elev><category
label="Age" term="Past day"/></entry>
</feed>

0 comments on commit 35c40c2

Please sign in to comment.