- Fix crash on matching array_each() against non-array
This commit is contained in:
parent
322325b0d3
commit
0aa0acc459
68
perl-Test-Deep-0.103-arrayeach.patch
Normal file
68
perl-Test-Deep-0.103-arrayeach.patch
Normal file
@ -0,0 +1,68 @@
|
||||
Fix comparison against stuff other than ARRAY references with array_each().
|
||||
|
||||
Patch by Tomas Heran <tomas.heran@gooddata.com>,
|
||||
Test by Lubomir Rintel <lubo.rintel@gooddata.com>
|
||||
Submitted upstream by mail on 2008-10-22.
|
||||
|
||||
diff -up Test-Deep-0.103/lib/Test/Deep/ArrayEach.pm.arrayeach Test-Deep-0.103/lib/Test/Deep/ArrayEach.pm
|
||||
--- Test-Deep-0.103/lib/Test/Deep/ArrayEach.pm.arrayeach 2005-11-30 15:09:02.000000000 +0100
|
||||
+++ Test-Deep-0.103/lib/Test/Deep/ArrayEach.pm 2008-10-22 18:40:22.000000000 +0200
|
||||
@@ -3,7 +3,7 @@ use warnings;
|
||||
|
||||
package Test::Deep::ArrayEach;
|
||||
|
||||
-use Test::Deep::Cmp;
|
||||
+use Test::Deep::Ref;
|
||||
|
||||
sub init
|
||||
{
|
||||
@@ -19,6 +19,8 @@ sub descend
|
||||
my $self = shift;
|
||||
my $got = shift;
|
||||
|
||||
+ return 0 unless $self->test_reftype($got, "ARRAY");
|
||||
+
|
||||
my $exp = [ ($self->{val}) x @$got ];
|
||||
|
||||
return Test::Deep::descend($got, $exp);
|
||||
diff -up Test-Deep-0.103/lib/Test/Deep/ArrayElementsOnly.pm.arrayeach Test-Deep-0.103/lib/Test/Deep/ArrayElementsOnly.pm
|
||||
--- Test-Deep-0.103/lib/Test/Deep/ArrayElementsOnly.pm.arrayeach 2005-11-30 15:09:21.000000000 +0100
|
||||
+++ Test-Deep-0.103/lib/Test/Deep/ArrayElementsOnly.pm 2008-10-22 18:40:22.000000000 +0200
|
||||
@@ -22,6 +22,8 @@ sub descend
|
||||
my $exp = $self->{val};
|
||||
|
||||
my $data = $self->data;
|
||||
+
|
||||
+ return 0 unless $self->test_reftype($got, "ARRAY");
|
||||
|
||||
for my $i (0..$#{$exp})
|
||||
{
|
||||
@@ -41,7 +43,9 @@ sub render_stack
|
||||
my $self = shift;
|
||||
my ($var, $data) = @_;
|
||||
$var .= "->" unless $Test::Deep::Stack->incArrow;
|
||||
- $var .= "[$data->{index}]";
|
||||
+ if (exists($data->{index})) {
|
||||
+ $var .= "[$data->{index}]";
|
||||
+ }
|
||||
|
||||
return $var;
|
||||
}
|
||||
diff -up Test-Deep-0.103/t/array_each.t.arrayeach Test-Deep-0.103/t/array_each.t
|
||||
--- Test-Deep-0.103/t/array_each.t.arrayeach 2005-11-30 15:08:22.000000000 +0100
|
||||
+++ Test-Deep-0.103/t/array_each.t 2008-10-22 18:40:22.000000000 +0200
|
||||
@@ -30,4 +30,14 @@ EOM
|
||||
},
|
||||
"array_each not eq"
|
||||
);
|
||||
+
|
||||
+ check_test(
|
||||
+ sub {
|
||||
+ cmp_deeply({}, array_each( ignore() ));
|
||||
+ },
|
||||
+ {
|
||||
+ actual_ok => 0,
|
||||
+ },
|
||||
+ "array_each not ARRAY reference"
|
||||
+ );
|
||||
}
|
||||
@ -1,11 +1,12 @@
|
||||
Name: perl-Test-Deep
|
||||
Version: 0.103
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Extremely flexible deep comparison
|
||||
License: GPL+ or Artistic
|
||||
Group: Development/Libraries
|
||||
URL: http://search.cpan.org/dist/Test-Deep/
|
||||
Source0: http://www.cpan.org/authors/id/F/FD/FDALY/Test-Deep-%{version}.tar.gz
|
||||
Patch0: perl-Test-Deep-0.103-arrayeach.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildArch: noarch
|
||||
BuildRequires: perl(ExtUtils::MakeMaker)
|
||||
@ -23,6 +24,7 @@ circular data structures without getting caught in an infinite loop.
|
||||
|
||||
%prep
|
||||
%setup -q -n Test-Deep-%{version}
|
||||
%patch0 -p1 -b .arrayeach
|
||||
|
||||
%build
|
||||
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
||||
@ -51,6 +53,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%changelog
|
||||
* Wed Oct 22 2008 Lubomir Rintel <lubo.rintel@gooddata.com> 0.103-2
|
||||
- Fix crash on matching array_each() against non-array
|
||||
|
||||
* Wed Jun 04 2008 Steven Pritchard <steve@kspei.com> 0.103-1
|
||||
- Update to 0.103.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user