File: 30_simple_xml.t

package info (click to toggle)
libxml-rss-simplegen-perl 11.11-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 280 kB
  • sloc: perl: 1,230; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 1,299 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

require 5;
use strict;
use Test;
BEGIN { plan tests => 16 }

print "# Starting ", __FILE__ , " ...\n";
ok 1;

#sub XML::RSS::SimpleGen::DEBUG () {20}

use XML::RSS::SimpleGen ();

sub r ($$) {
  my($m,$v) = @_;
  my $r = XML::RSS::SimpleGen->new('http://test.int/','blorg');
  $r->$m($v);
  $r->as_string;
}

ok r('ttl', '30'), '/<ttl>30</ttl>/';

ok r('skipHours', 1), '/<skipHours>\s*<hour>1</hour>\s*</skipHours>/';
ok r('skipDays' , 1), '/<skipDays>\s*<day>Monday</day>\s*</skipDays>/';
ok r('skipDays' , 'Monday'), '/<skipDays>\s*<day>Monday</day>\s*</skipDays>/';
ok r('skipDays' , 'Monday'), '/<skipDays>\s*<day>Monday</day>\s*</skipDays>/';
ok r('language' , 'sgn-us'), '/<language>sgn-us</language>/';
ok r('css', './foo.css'), '/foo\.css/';
ok r('xsl', './foo.xsl'), '/foo\.xsl/';
ok r('webMaster', 'jojo@mojo.int'), '/<webMaster>jojo@mojo.int</webMaster>/';
ok r('docs', 'http://whatever.int'), '/<docs>http://whatever\.int</docs>/';
ok r('url', 'http://whatever.int'), '/<link>http://whatever.int</link>/';
ok r('title', 'jojo@mojo.int'), '/<title>jojo@mojo.int</title>/';
ok r('description', 'jojo@mojo.int'), '/<description>jojo@mojo.int</description>/';
ok r('item', 'http://whatever.int'), '/<link>http://whatever.int</link>/';

print "# Done at ", scalar(localtime), ".\n";
ok 1;