Last active
August 29, 2015 14:05
-
-
Save nikita-d/3add4eb523b6269ac0b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
$ENV{BAIL_ON_FAIL} ||= 1; | |
} | |
use Modern::Perl qw|2013|; | |
use Data::Printer (use_prototypes => 0); | |
use Test::Most; | |
use Mojo::DOM; | |
my $rss = "<channel> | |
<link>http://host.example</link> | |
<description>Lorem ipsum dolor sit amet</description> | |
<encoding>UTF-8</encoding> | |
<language>ru-ru</language> | |
<title>RSS Channel Title</title> | |
</channel> | |
"; | |
my $dom = Mojo::DOM->new($rss); | |
$dom->xml(1); | |
is($dom->xml, 1, 'xml semantics enabled'); | |
is($dom->at("channel > title")->text, 'RSS Channel Title', 'correct title'); | |
is($dom->at("channel > encoding")->text, 'UTF-8', 'correct encoding'); | |
is($dom->at("channel > language")->text, 'ru-ru', 'correct language'); | |
is($dom->at("channel > link")->text, 'http://host.example', 'correct link') ; # - this one fails | |
say p $dom.""; | |
# "<channel> | |
# <link />http://host.example | |
# <description>Lorem ipsum dolor sit amet</description> | |
# <encoding>UTF-8</encoding> | |
# <language>ru-ru</language> | |
# <title>RSS Channel Title</title> | |
# </channel> | |
# " | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment