File: regress-2.0-namespace.t

package info (click to toggle)
libxml-rss-libxml-perl 0.3105%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 484 kB
  • sloc: perl: 4,940; xml: 41; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use Test::More tests => 8;
use XML::RSS::LibXML;

for my $ver (qw( 1.0 2.0 )) {
    my $feed = XML::RSS::LibXML->new( version => $ver );
    $feed->channel(title => "Hello world");
    $feed->channel(webMaster => "foobar");
    $feed->channel->{dc}{creator} = "foobar";

    my $string = $feed->as_string;
    like $string, qr/xmlns:dc="[^"]+"/, "namespace declaration for $ver";
    like $string, qr{<dc:creator>foobar</dc:creator>}, "actual element for $ver";

    $string = $feed->parse($feed->as_string)->as_string;
    like $string, qr/xmlns:dc="[^"]+"/, "namespace declaration for $ver";
    like $string, qr{<dc:creator>foobar</dc:creator>}, "actual element for $ver";
}