File: 60_types.t

package info (click to toggle)
libxml-dt-perl 0.69-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 388 kB
  • sloc: perl: 1,432; xml: 438; makefile: 16
file content (44 lines) | stat: -rw-r--r-- 736 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
40
41
42
43
44
# -*- cperl -*-

use Test::More tests => 5;
use Data::Dumper;

BEGIN {
  use_ok( 'XML::DT' );
}

my $XML = <<EOX;
<?xml version="1.0"?>
<xml>foo<bar>foo</bar>foo</xml>
EOX

like(dtstring($XML,
	      -default => sub { $c },
	      -type => {bar=>'SEQ'}
	     ), qr/fooARRAY\(0x[0-9a-f]+\)foo/);




is_deeply(dtstring($XML,
		   -default => sub { $c },
		   -type => {bar=>'SEQ',
			     -default=>'SEQ'}
		  ),
	  ['foo',['foo'],'foo']);



is_deeply(dtstring($XML,
		   -default => sub { $c },
		   -type => {-default=>'SEQ'}
		  ),
	  ['foo',['foo'],'foo']);



is(toxml(dtstring($XML,
		  -default => sub { $c },
		  -type => {-default=>'SEQH'})),
   "foo\n<bar>foo</bar>\nfoo");                       # yeah, we lose the xml tag.