File: xml_simple.t

package info (click to toggle)
libcatmandu-xml-perl 0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 216 kB
  • sloc: perl: 387; xml: 28; makefile: 2; sh: 1
file content (18 lines) | stat: -rw-r--r-- 498 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use warnings;
use Test::More;
use Catmandu::Fix::xml_simple as => 'simple';

my $xml = '<root><a>x</a><a>y</a><a>z</a></root>';
my $data = { xml => $xml };
simple($data,'xml');
is_deeply $data->{xml}, { a => [qw(x y z)] }, 'parse with xml_simple';

# TODO: include attributes

$xml = [ root => {}, [[a=>{},['x']],[a=>{},['y']],[a=>{},['z']] ] ];
$data = { xml => $xml };
simple($data,'xml');
is_deeply $data, { xml => { a => [qw(x y z)] } }, 'transform with xml_simple';

done_testing;