GIF87a;
use strict; use warnings; package Test::Deep::Methods; use Test::Deep::Cmp; use Scalar::Util; sub init { my $self = shift; # get them all into [$name,@args] => $value format my @methods; while (@_) { my $name = shift; my $value = shift; push(@methods, [ ref($name) ? $name : [ $name ], $value ] ); } $self->{methods} = \@methods; } sub descend { my $self = shift; my $got = shift; my $data = $self->data; foreach my $method (@{$self->{methods}}) { $data->{method} = $method; my ($call, $exp_res) = @$method; my ($name, @args) = @$call; local $@; my $got_res; if (! eval { $got_res = $self->call_method($got, $call); 1 }) { die $@ unless $@ =~ /\ACan't locate object method "\Q$name"/; $got_res = $Test::Deep::DNE; } next if Test::Deep::descend($got_res, $exp_res); return 0; } return 1; } sub call_method { my $self = shift; my ($got, $call) = @_; my ($name, @args) = @$call; return $got->$name(@args); } sub render_stack { my $self = shift; my ($var, $data) = @_; my $method = $data->{method}; my ($call, $expect) = @$method; my ($name, @args) = @$call; my $args = @args ? "(".join(", ", @args).")" : ""; $var .= "->$name$args"; return $var; } 1;
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Cache | Folder | 0755 |
|
|
All.pm | File | 702 B | 0444 |
|
Any.pm | File | 908 B | 0444 |
|
Array.pm | File | 477 B | 0444 |
|
ArrayEach.pm | File | 517 B | 0444 |
|
ArrayElementsOnly.pm | File | 677 B | 0444 |
|
ArrayLength.pm | File | 374 B | 0444 |
|
ArrayLengthOnly.pm | File | 654 B | 0444 |
|
Blessed.pm | File | 564 B | 0444 |
|
Boolean.pm | File | 558 B | 0444 |
|
Cache.pm | File | 1.01 KB | 0444 |
|
Class.pm | File | 363 B | 0444 |
|
Cmp.pm | File | 1.13 KB | 0444 |
|
Code.pm | File | 705 B | 0444 |
|
Hash.pm | File | 1.38 KB | 0444 |
|
HashEach.pm | File | 326 B | 0444 |
|
HashElements.pm | File | 1.24 KB | 0444 |
|
HashKeys.pm | File | 999 B | 0444 |
|
HashKeysOnly.pm | File | 1.5 KB | 0444 |
|
Ignore.pm | File | 186 B | 0444 |
|
Isa.pm | File | 538 B | 0444 |
|
ListMethods.pm | File | 288 B | 0444 |
|
MM.pm | File | 922 B | 0444 |
|
Methods.pm | File | 1.28 KB | 0444 |
|
NoTest.pm | File | 788 B | 0444 |
|
None.pm | File | 869 B | 0444 |
|
Number.pm | File | 1.06 KB | 0444 |
|
Obj.pm | File | 522 B | 0444 |
|
Ref.pm | File | 490 B | 0444 |
|
RefType.pm | File | 547 B | 0444 |
|
Regexp.pm | File | 1.38 KB | 0444 |
|
RegexpMatches.pm | File | 662 B | 0444 |
|
RegexpOnly.pm | File | 521 B | 0444 |
|
RegexpRef.pm | File | 639 B | 0444 |
|
RegexpRefOnly.pm | File | 423 B | 0444 |
|
RegexpVersion.pm | File | 280 B | 0444 |
|
ScalarRef.pm | File | 432 B | 0444 |
|
ScalarRefOnly.pm | File | 384 B | 0444 |
|
Set.pm | File | 3.61 KB | 0444 |
|
Shallow.pm | File | 597 B | 0444 |
|
Stack.pm | File | 1.05 KB | 0444 |
|
String.pm | File | 369 B | 0444 |
|