Test-Deep - Defining optional hash keys

Posted on Mon Mar 3 23:20:32 2008 by random
Defining optional hash keys
Is there any possibility to define an optional hash-key for comparison? I though about something like:
$data_expect = { name => 'tester', data => ignore(), records => 0, ignore('husband') => 'joey' };
Here data can be of any type, but the hash key must exists, whereas for the haskey husband it is allowed to be non-existing at all, but if it exists it must still match 'joey' (ignore could be used to ignore that too). Of course that would require that comparisions would check the hashkeys, not the values. Any thoughts on that?
Direct Responses: 7257 | Write a response