[libcgi-application-plugin-ajaxupload-perl] 01/03: add patch fixing comparison of structures as json-encoded strings

Damyan Ivanov dmn at alioth.debian.org
Tue Sep 3 13:47:43 UTC 2013


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to branch master
in repository libcgi-application-plugin-ajaxupload-perl.

commit b7f25b34bde466cb6ac8892e80145dc6d4525338
Author: Damyan Ivanov <dmn at debian.org>
Date:   Tue Sep 3 16:43:24 2013 +0300

    add patch fixing comparison of structures as json-encoded strings
    
    fixes test failures with perl 5.18, which has improved hash
    randomization (Closes: #719986)
---
 debian/patches/compare-structures.patch |  110 +++++++++++++++++++++++++++++++
 debian/patches/series                   |    1 +
 2 files changed, 111 insertions(+)

diff --git a/debian/patches/compare-structures.patch b/debian/patches/compare-structures.patch
new file mode 100644
index 0000000..158e310
--- /dev/null
+++ b/debian/patches/compare-structures.patch
@@ -0,0 +1,110 @@
+Description: compare structures as such, not as json-encoded strings
+ The problem with json-encoded strings is that hash keys' order is
+ unpredictable from perl 5.18 on
+Author: Damyan Ivanov <dmn at debian.org>
+Bug: https://rt.cpan.org/Ticket/Display.html?id=88002
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719986
+Forwarded: yes
+
+--- a/t/04-resize.t
++++ b/t/04-resize.t
+@@ -267,7 +267,7 @@ subtest 'options' => sub{
+     isa_ok($app, 'CGI::Application');
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"$upload_subdir/test.jpeg"}!xms,
++        { status => "UPLOADED", image_url => "$upload_subdir/test.jpeg" },
+         'UPLOADED'
+     );
+     size_ok("$tmpdir_name$upload_subdir/test.jpeg", [300,int(250*300/400)], "size 300x200");
+@@ -293,7 +293,7 @@ subtest 'UPLOADED' => sub{
+     $app->query->param(validate=>1);
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms,
++        { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" },
+         'UPLOADED'
+     );
+     size_ok("$tmpdir_name/img/uploads/test.jpeg", [300,int(250*300/400)], "size 300x200");
+@@ -320,7 +320,7 @@ subtest 'png' => sub{
+     $app->query->param(validate=>1);
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms,
++        { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" },
+         'UPLOADED'
+     );
+     size_ok("$tmpdir_name/img/uploads/test.jpeg", [300,int(250*300/400)], "size 300x200");
+@@ -347,7 +347,7 @@ subtest 'square' => sub{
+     $app->query->param(validate=>1);
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms,
++        { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" },
+         'UPLOADED'
+     );
+     size_ok("$tmpdir_name/img/uploads/test.jpeg", [80,50], "size 300x50");
+--- a/t/lib/TestWebApp.pm
++++ b/t/lib/TestWebApp.pm
+@@ -1,6 +1,6 @@
+ package TestWebApp;
+ use base qw(CGI::Application);
+-use CGI::Application::Plugin::JSON qw(to_json);
++use CGI::Application::Plugin::JSON qw(to_json from_json);
+ use CGI::Application::Plugin::AJAXUpload;
+ use File::Temp;
+ use Test::More;
+@@ -51,7 +51,12 @@ sub response_like {
+ 
+     my ($header, $body) = split /\r\n\r\n/, $output;
+     like($header, $header_re, "$comment (header match)");
+-    like($body, $body_re, "$comment (body match)");
++    if ( ref($body_re) and ref($body_re) eq 'HASH' ) {
++        is_deeply( $self->from_json($body), $body_re, "$comment (body json)" );
++    }
++    else {
++        like($body, $body_re, "$comment (body match)");
++    }
+ 
+     return;
+ }
+--- a/t/02.warnings.t
++++ b/t/02.warnings.t
+@@ -303,7 +303,7 @@ subtest 'options' => sub{
+     isa_ok($app, 'CGI::Application');
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"$upload_subdir/test.txt"}!xms,
++        { status => "UPLOADED", image_url => "$upload_subdir/test.txt" },
+         'UPLOADED'
+     );
+     is(slurp("$tmpdir_name$upload_subdir/test.txt"), "This is a test!", 'file contents');
+@@ -329,7 +329,7 @@ subtest 'UPLOADED' => sub{
+     $app->query->param(validate=>1);
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"/img/uploads/test.txt"}!xms,
++        { status => "UPLOADED", image_url => "/img/uploads/test.txt" },
+         'UPLOADED'
+     );
+     is(slurp("$tmpdir_name/img/uploads/test.txt"), "This is a test!", 'file contents');
+--- a/t/03.images.t
++++ b/t/03.images.t
+@@ -240,7 +240,7 @@ subtest 'options' => sub{
+     isa_ok($app, 'CGI::Application');
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"$upload_subdir/test.jpeg"}!xms,
++        { status => "UPLOADED", image_url => "$upload_subdir/test.jpeg" },
+         'UPLOADED'
+     );
+     my $size = -s "$tmpdir_name/$upload_subdir/test.jpeg";
+@@ -264,7 +264,7 @@ subtest 'UPLOADED' => sub{
+     $app->query->param(validate=>1);
+     $app->response_like(
+         $CONTENT_RE,
+-        qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms,
++        { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" },
+         'UPLOADED'
+     );
+     my $size = -s "$tmpdir_name/img/uploads/test.jpeg";
diff --git a/debian/patches/series b/debian/patches/series
index 5b80bbb..cffab8a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 file-size-tests.patch
 spelling.patch
+compare-structures.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-application-plugin-ajaxupload-perl.git



More information about the Pkg-perl-cvs-commits mailing list