This module is a complement to Test::Simple or Test::More (or any other testing module based on Test::Builder). It adds the function in_domain to your panoply of testing tools; that function uses the functionalities of Data::Domain to check deep datastructures and produce detailed reports about where the data differs from the expectations.

The synopsis above is just an appetizer : many more kinds of comparisons can be performed; see Data::Domain for details.

This test succeeds if $domain->inspect($data) fails, i.e. the data is not in the domain. By default the error messages will not be printed (since the error was expected, the messages are not interesting!); however, if the fourth argument $want_explanation is true, then the messages will be printed as a note (so they won't be seen when the test in run in a harness, but will be visible in the verbose TAP stream).

By default, all symbols from Data::Domain will be exported into the caller's namespace : Int, String, List, Struct, True, Defined, Obj, etc. However it is also possible to explicitly state what to import, and even to rename the imported symbols through Sub::Exporter options, like for example :

use Test::InDomain -constructors => {-prefix => "dom_"};

To achieve this, the import list passed to Test::InDomain is transmitted directly to Data::Domain; by contrast, functions specific to Test::InDomain, namely in_domain and not_in_domain, are not affected by the import list and will be exported in any case.