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


Test-Struct documentation  | view source Contained in the Test-Struct distribution.

Index


NAME

Top

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

SYNOPSIS

Top

  use Test::Struct;

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

DESCRIPTION

Top

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

Top

Test::More, Test::Builder

AUTHOR

Top

Yves Orton, Demerphq at the Google email service.

COPYRIGHT AND LICENSE

Top


Test-Struct documentation  | view source Contained in the Test-Struct distribution.