File: issue-10.t

package info (click to toggle)
libxml-struct-perl 0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 220 kB
  • sloc: perl: 600; xml: 17; sh: 6; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 788 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use Test::More;
use XML::Struct qw(readXML);

my $xml = <<XML;
<journal-meta>
    <journal type="nlm-ta">BMC Womens Health 1</journal>
    <journal type="iso-abbrev">BMC Womens Health 2</journal>
  </journal-meta>
XML

my $simple = readXML($xml, simple => 1);
is_deeply $simple, { journal => [
             { type => 'nlm-ta',     content => 'BMC Womens Health 1' },
             { type => 'iso-abbrev', content => 'BMC Womens Health 2' }
      ] }, 'include content for simple XML';

$simple = readXML($xml, simple => 1, content => 'name' );
is_deeply $simple, { journal => [
             { type => 'nlm-ta',     name => 'BMC Womens Health 1' },
             { type => 'iso-abbrev', name => 'BMC Womens Health 2' }
      ] }, 'include content for simple XML';

done_testing;