Debian Codegraph @

t/09-x2h_cdata.t

raw
1 package main;
2 use strict;
3 use warnings;
4
5 use Test::More tests => 4;
6 use Data::Dumper;
7 $Data::Dumper::Indent = 0;
8 $Data::Dumper::Sortkeys = 1;
9
10 use XML::Hash::XS 'xml2hash';
11 $XML::Hash::XS::keep_root = 0;
12
13 our $xml_decl_utf8 = qq{<?xml version="1.0" encoding="utf-8"?>};
14
15 {
16 is
17 xml2hash("<cdata><![CDATA[\n\t abcde!@#\$%^&*<>\n\t ]]></cdata>"),
18 "\n\t abcde!\@#\$%^&*<>\n\t ",
19 'use special symbols',
20 ;
21 }
22
23 {
24 is
25 xml2hash("<cdata><![CDATA[ [ abc ] ]> ]]]]]]></cdata>"),
26 ' [ abc ] ]> ]]]]',
27 'terminate section',
28 ;
29 }
30
31 {
32 is
33 xml2hash("<cdata><![CDATA[ ]]]></cdata>"),
34 ' ]',
35 'terminate section2',
36 ;
37 }
38
39 {
40 is
41 xml2hash("<cdata><![CDATA[]]></cdata>"),
42 '',
43 'empty section',
44 ;
45 }