File: Bug_simple_with_cdata.t

package info (click to toggle)
libxml-bare-perl 0.53-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,388 kB
  • sloc: xml: 15,836; perl: 1,331; ansic: 1,025; cpp: 41; makefile: 3
file content (15 lines) | stat: -rwxr-xr-x 425 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl -w

use strict;

use Test::More qw(no_plan);

use_ok( 'XML::Bare', qw/xmlin/ );

my ( $ob, $root ) = XML::Bare->simple( text => "<node att='2'><![CDATA[cdata contents]]></node>" ); 

ok( $root, "Got some root" );
my $attval = $root->{'node'}{'att'};
is( $attval, '2', "Got the right attribute value" );
my $cdataval = $root->{'node'}{'content'};
is( $cdataval, 'cdata contents', "Got the right cdata value" );