rpms/perl-Test-Deep/devel perl-Test-Deep-0.103-arrayeach.patch, NONE, 1.1 perl-Test-Deep.spec, 1.13, 1.14

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Author: lkundrak

Update of /cvs/pkgs/rpms/perl-Test-Deep/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13925

Modified Files:
	perl-Test-Deep.spec 
Added Files:
	perl-Test-Deep-0.103-arrayeach.patch 
Log Message:
* Wed Oct 22 2008 Lubomir Rintel <lubo.rintel@xxxxxxxxxxxx> 0.103-2
- Fix crash on matching array_each() against non-array


perl-Test-Deep-0.103-arrayeach.patch:

--- NEW FILE perl-Test-Deep-0.103-arrayeach.patch ---
Fix comparison against stuff other than ARRAY references with array_each().

Patch by Tomas Heran <tomas.heran@xxxxxxxxxxxx>,
Test by Lubomir Rintel <lubo.rintel@xxxxxxxxxxxx>
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"
+	);
 }


Index: perl-Test-Deep.spec
===================================================================
RCS file: /cvs/pkgs/rpms/perl-Test-Deep/devel/perl-Test-Deep.spec,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- perl-Test-Deep.spec	4 Jun 2008 19:59:36 -0000	1.13
+++ perl-Test-Deep.spec	22 Oct 2008 16:45:16 -0000	1.14
@@ -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 @@
 
 %prep
 %setup -q -n Test-Deep-%{version}
+%patch0 -p1 -b .arrayeach
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor
@@ -51,6 +53,9 @@
 %{_mandir}/man3/*
 
 %changelog
+* Wed Oct 22 2008 Lubomir Rintel <lubo.rintel@xxxxxxxxxxxx> 0.103-2
+- Fix crash on matching array_each() against non-array
+
 * Wed Jun 04 2008 Steven Pritchard <steve@xxxxxxxxx> 0.103-1
 - Update to 0.103.
 

--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
Fedora-perl-devel-list mailing list
Fedora-perl-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-perl-devel-list

[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux