Hey all,
Is there an is_deeply()-esque function somewhere that does not belong to a test module? It works perfectly for what I'm trying to do, but I can't get the test output to redirect properly, and it interferes with my actual unit tests.
I've put some code I was toying with for testing below, just because it's the right thing to do on PerlMonks when asking a question. It's awful for many reasons, fails unsafely, and uses experimental features. I'm sure things will click together when I look at it tomorrow, but the ol' brain has given up thinking with it being Friday afternoon and all.
In the code, I've shortened certain things to fit reasonably nicely... s/current/c/, s/previous/p/. The structure is a hash ref that contains either strings or arrays.
self->{cache_safe} = 1; my @unsafe_cache_params = qw(file extensions include exclude search); my $c = $self->{params}; my $p = $self->{p_run_config}; { no warnings 'uninitialized'; for (@unsafe_cache_params){ if (defined $c->{$_} || defined $p->{$_}){ if (ref $c->{$_} eq 'ARRAY' || ref $p->{$_} eq 'ARRAY'){ if (! (@{$c->{$_}} ~~ @{$p->{$_}})){ $self->{cache_safe} = 0; last; } } elsif ($c->{$_} ne $p->{$_}){ $self->{cache_safe} = 0; last; } } } }
All I need to do is verify whether certain portions of the data structure that is the configuration of the last run are the same as this run.
In reply to Is there an is_deeply() outside of Test::More? by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |