File: 02-inject.t

package info (click to toggle)
libxml-hash-lx-perl 0.0603-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 408 kB
  • sloc: perl: 2,603; makefile: 5
file content (33 lines) | stat: -rw-r--r-- 677 bytes parent folder | download | duplicates (3)
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
#!/use/bin/perl -w

use strict;
use Test::More;
BEGIN {
	my $add = 0;
	eval {require Test::NoWarnings;Test::NoWarnings->import; ++$add; 1 }
		or diag "Test::NoWarnings missed, skipping no warnings test";
	plan tests => 3 + $add;
}

use lib::abs '../lib';
use XML::LibXML;
use XML::Hash::LX ':inject';
use XML::Hash::LX ':inject'; # duplicate call shouldn't produce warning

our $xml = q{
	<root at="key">
		<nest>
			first
			<v>a</v>
			mid
			<v at="a">b</v>
			<vv></vv>
			last
		</nest>
	</root>
};

my $doc = XML::LibXML->new->parse_string($xml);
ok $doc->can('toHash'), 'doc->toHash';
ok $doc->documentElement->can('toHash'), 'elm->toHash';
ok ref $doc->toHash, 'hash';