--- Fergal Daly <[EMAIL PROTECTED]> wrote:

> use Test::More no_plan;
> use Test::Deep;
> 
> my $expect = {
>    name => re(qr/porky/),
>    value => code(sub { $_[0] >= 0 && $_[0] < 10 || (0, "out of range
> [0,10)")}),
>    spigot_state => 'active',
> };
> 
> my $value = {
>    name => 'My name is porky',
>    value => 11,                                # <-- fails here
>    spigot_state => 'active',
> };
> 
> cmp_deeply( $value, $expect, 'Whoopee!');

Side note:  ++ to Test::Deep.  That modules has solved some of the
thorniest testing problems I've come across.

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to