File: 01-simple.t

package info (click to toggle)
libxml-writer-simple-perl 0.08-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 128 kB
  • sloc: perl: 256; xml: 7; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 690 bytes parent folder | download
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
#!/usr/bin/perl 

use Test::More tests => 11;
use XML::Writer::Simple tags => [qw/a b c d e/];

like(xml_header, qr/^<\?xml version="1\.0"\?>\n$/);

like(xml_header(encoding=>'iso-8859-1'), qr/^<\?xml version="1\.0" encoding="iso-8859-1"\?>\n$/);

is(a(b(c(d(e('f'))))), "<a><b><c><d><e>f</e></d></c></b></a>");

is(a(b('a'),c('a')), "<a><b>a</b><c>a</c></a>");

is(a(b(['a'..'h'])), "<a><b>a</b><b>b</b><b>c</b><b>d</b><b>e</b><b>f</b><b>g</b><b>h</b></a>");

is(a({-foo=>'bar'}), "<a foo=\"bar\"/>");

is(a({foo=>'bar'}), "<a foo=\"bar\"/>");

is(a({-foo=>'bar'},'x'), "<a foo=\"bar\">x</a>");

is(a({foo=>'bar'},'x'), "<a foo=\"bar\">x</a>");

is(a(), "<a/>");

is(a(0), "<a>0</a>");