Yves > Test-Struct > Test::Struct

Download:
Test-Struct-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Test::Struct - Perl extension for testing for structural equivelence.

SYNOPSIS ^

  use Test::Struct;

  deep_eq($hairy_struct,$expected,'Hairy structural test');
  is($x,$y); # and everything else Test::More has to offer!

DESCRIPTION ^

Test::Struct is used for doing deep structural comparisons of two objects. The module contains only one subrotuine which is intended to be used as a mix-in with other more generic Test::Builder derived modules like Test::More or Test::Simple. The code normally uses Scalar::Util for inspecting the data, but it will also use additional fine tuned comparison tools from Data::Dump::Streamer if they are available.

deep_eq($got,$expected,$name)

Does a deep level comparison of two objects. It traverses the two structures in parallel checking as many attributes as it can for differences. If the objects differ it will output a diagnostic message containing a list of the differences it encountered before it finished the comparison. Some types of mismatch prevent further comparison so the list may not be exhaustive.

The intention of this routine is that it will pass the test only if $got is functionally identical to $expected. However, at current time there are some data types it does not handle properly, such as CODE refs.

EXPORT

Only deep_eq().

SEE ALSO ^

Test::More, Test::Builder

AUTHOR ^

Yves Orton, Demerphq at the Google email service.

COPYRIGHT AND LICENSE ^

Copyright (C) 2005 by Yves Orton

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: