NAME
Test::XML::Deep = XML::Simple + Test::Deep
VERSION
Version 0.02
SYNOPSIS
This module can be used to easily test that some XML has the structure and values you desire.
It is particularly useful when some values in your XML document may differ from one test run to another (for example, a timestamp).
An Example:
use Test::XML::Deep;
my $xml = <<EOXML;
<?xml version="1.0" encoding="UTF-8"?>
<example>
<sometag attribute="value">some data</sometag>
<sometag attribute="other">more data</sometag>
</example>
EOXML
my $expected = { 'sometag' => [
{
'attribute' => 'value',
'content' => 'some data'
},
{
'attribute' => 'other',
'content' => 'more data'
}
]
};
cmp_xml_deeply($xml, $expected);
Or, you can use Test::Deep and make use of the functions it exports (I.E. array_each(), re()):
use Test::Deep;
use Test::XML::Deep;
my $xml = <<EOXML;
<?xml version="1.0" encoding="UTF-8"?>
<example>
<sometag attribute="1234">some data</sometag>
<sometag attribute="4321">more data</sometag>
</example>
EOXML
my $expected = { 'sometag' => array_each( { 'attribute' => re('^\d+$'),
'content' => re('data$'),
}
)
};
cmp_xml_deeply($xml, $expected);
EXPORT
cmp_xml_deeply
FUNCTIONS
cmp_xml_deeply
AUTHOR
Jeff Lavallee, <jeff at zeroclue.com>
BUGS
Please report any bugs or feature requests to bug-test-xml-deep at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-XML-Deep. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Test::XML::Deep
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2009 Jeff Lavallee, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.