XML-Quick

 view release on metacpan or  search on metacpan

t/20-keep-object.t  view on Meta::CPAN

#!perl -T

use warnings;
use strict;

use Test::More;

use XML::Quick;
use Data::Dumper;

plan tests => 3;

sub _dump {
    my ($hash) = @_;
    local $Data::Dumper::Terse  = 1;
    local $Data::Dumper::Indent = 1;
    return Dumper $hash;
}

{
    my $hash = {
        root => {
            _attrs => { attr => 'value' },
        },
    };
    my $hash_orig = _dump($hash);
    xml($hash);
    is(_dump($hash), $hash_orig, "passed data hash retains attrs");
}

{
    my $hash = {
        root => {
            _cdata => '_cdata text',
            cdata  => 'cdata tag',
            tag    => 'text',
        },
    };
    my $hash_orig = _dump($hash);
    xml($hash);
    is(_dump($hash), $hash_orig, "passed data hash retains cdata");
}

{
    my $hash = {
        root => {
            _attrs => { attr=>'value' },
        },
    };
    my $opts = {};
    my $opts_orig = _dump($opts);
    xml($hash, $opts);
    is(_dump($opts), $opts_orig, "passed opts hash not modified");
}



( run in 0.671 second using v1.01-cache-2.11-cpan-39bf76dae61 )