Subject: | feature requirement: hash_without_keys - test the absense of certain keys, |
I need to test absence of the certain key(s) in hash ignoring everithing
else.
Sample usage:
cmp_deep(
parse('<lot_of_parameters>IMPORTANT_PARAMETER=GOOD_VALUE<lot_of_parameters>'),
{'parsed'=>1, 'params' => superhashof('IMPORTANT_PARAMETER' =>
'GOOD_VALUE')}, 'test if parameter exist');
cmp_deep(
parse('<lot_of_parameters>IMPORTANT_PARAMETER=BAD_VALUE<lot_of_parameters>'),
{'parsed'=>1, 'params' => hash_without_keys(['IMPORTANT_PARAMETER'])},
'test that parameter is absent, because it value is bad');
Of course I can simply check the absence of ineteresting keys one by one
by is(exists ...) or even ok(). But it breaks the nice and clean look of
my tests, for most of which i use Test::Deep, as resulting structures
are complicated.