File: 53_empty_text_node.t

package info (click to toggle)
libxml-treepp-perl 0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 680 kB
  • sloc: perl: 810; xml: 58; sh: 41; makefile: 2
file content (23 lines) | stat: -rwxr-xr-x 785 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
# ----------------------------------------------------------------
    use strict;
    use Test::More;
# ----------------------------------------------------------------
    my $tree1 = {root=>{-attr=>'val', "#text"=>""}};
    my $tree2 = {root=>{-attr=>'val', "#text"=>undef}};
# ----------------------------------------------------------------
{
    plan tests => 3;
    use_ok('XML::TreePP');

    my $tpp = XML::TreePP->new();
    my $xml;

    $xml = $tpp->write($tree1);
    like($xml, qr:<root [^>]*></root>:, "text node with zero length string");

    $xml = $tpp->write($tree2);
    like($xml, qr:<root [^>]*/>:, "text node of undef");
}
# ----------------------------------------------------------------
;1;
# ----------------------------------------------------------------