Hello community,
here is the log from the commit of package perl-Mojolicious for
openSUSE:Factory checked in at 2020-06-04 17:56:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new.3606 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious"
Thu Jun 4 17:56:50 2020 rev:134 rq:811445 version:8.52
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes
2020-06-03 20:33:29.141353759 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Mojolicious.new.3606/perl-Mojolicious.changes
2020-06-04 17:56:53.201086340 +0200
@@ -1,0 +2,11 @@
+Thu Jun 4 03:10:36 UTC 2020 - Tina Müller <[email protected]>
+
+- updated to 8.52
+ see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+ 8.52 2020-06-01
+ - Updated project metadata.
+ - Fixed a bug in Mojo::Asset::Memory where the upgrade event could not
change the temporary directory.
+
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-8.51.tar.gz
New:
----
Mojolicious-8.52.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.cpfbPf/_old 2020-06-04 17:56:53.977088770 +0200
+++ /var/tmp/diff_new_pack.cpfbPf/_new 2020-06-04 17:56:53.981088782 +0200
@@ -17,7 +17,7 @@
Name: perl-Mojolicious
-Version: 8.51
+Version: 8.52
Release: 0
%define cpan_name Mojolicious
Summary: Real-time web framework
++++++ Mojolicious-8.51.tar.gz -> Mojolicious-8.52.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/Changes new/Mojolicious-8.52/Changes
--- old/Mojolicious-8.51/Changes 2020-05-31 14:28:02.000000000 +0200
+++ new/Mojolicious-8.52/Changes 2020-06-03 16:07:30.000000000 +0200
@@ -1,4 +1,8 @@
+8.52 2020-06-01
+ - Updated project metadata.
+ - Fixed a bug in Mojo::Asset::Memory where the upgrade event could not
change the temporary directory.
+
8.51 2020-05-30
- Improved map efficiency in Mojo::Promise. (mst)
- Improved more tests to use subtests. (veesh)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/META.json
new/Mojolicious-8.52/META.json
--- old/Mojolicious-8.51/META.json 2020-05-31 14:29:02.000000000 +0200
+++ new/Mojolicious-8.52/META.json 2020-06-03 22:00:39.000000000 +0200
@@ -58,8 +58,11 @@
"url" : "https://github.com/mojolicious/mojo.git",
"web" : "https://github.com/mojolicious/mojo"
},
- "x_IRC" : "irc://irc.freenode.net/#mojo"
+ "x_IRC" : {
+ "url" : "irc://irc.freenode.net/#mojo",
+ "web" : "https://webchat.freenode.net/#mojo"
+ }
},
- "version" : "8.51",
+ "version" : "8.52",
"x_serialization_backend" : "JSON::PP version 4.04"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/META.yml
new/Mojolicious-8.52/META.yml
--- old/Mojolicious-8.51/META.yml 2020-05-31 14:29:02.000000000 +0200
+++ new/Mojolicious-8.52/META.yml 2020-06-03 22:00:39.000000000 +0200
@@ -27,10 +27,12 @@
Sub::Util: '1.41'
perl: '5.016'
resources:
- IRC: irc://irc.freenode.net/#mojo
+ IRC:
+ url: irc://irc.freenode.net/#mojo
+ web: https://webchat.freenode.net/#mojo
bugtracker: https://github.com/mojolicious/mojo/issues
homepage: https://mojolicious.org
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/mojolicious/mojo.git
-version: '8.51'
+version: '8.52'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/Makefile.PL
new/Mojolicious-8.52/Makefile.PL
--- old/Mojolicious-8.51/Makefile.PL 2020-05-30 23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/Makefile.PL 2020-06-03 16:07:35.000000000 +0200
@@ -27,7 +27,7 @@
url => 'https://github.com/mojolicious/mojo.git',
web => 'https://github.com/mojolicious/mojo',
},
- x_IRC => 'irc://irc.freenode.net/#mojo'
+ x_IRC => {url => 'irc://irc.freenode.net/#mojo', web =>
'https://webchat.freenode.net/#mojo'}
},
},
PREREQ_PM => {'IO::Socket::IP' => '0.37', 'Sub::Util' => '1.41'},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Asset/Memory.pm
new/Mojolicious-8.52/lib/Mojo/Asset/Memory.pm
--- old/Mojolicious-8.51/lib/Mojo/Asset/Memory.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojo/Asset/Memory.pm 2020-06-01
14:10:18.000000000 +0200
@@ -14,8 +14,8 @@
# Upgrade if necessary
$self->{content} .= $chunk;
return $self if !$self->auto_upgrade || $self->size <=
$self->max_memory_size;
- $self->emit(upgrade => my $file = $self->to_file);
- return $file;
+ $self->emit(upgrade => my $file = Mojo::Asset::File->new);
+ return $file->add_chunk($self->slurp);
}
sub contains {
@@ -34,9 +34,7 @@
$max //= 131072;
$offset += $self->start_range;
- if (my $end = $self->end_range) {
- $max = $end + 1 - $offset if ($offset + $max) > $end;
- }
+ if (my $end = $self->end_range) { $max = $end + 1 - $offset if ($offset +
$max) > $end }
return substr shift->{content} // '', $offset, $max;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Content.pm
new/Mojolicious-8.52/lib/Mojo/Content.pm
--- old/Mojolicious-8.51/lib/Mojo/Content.pm 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/lib/Mojo/Content.pm 2020-06-01 03:08:27.000000000
+0200
@@ -13,15 +13,10 @@
my $BOUNDARY_RE =
qr!multipart.*boundary\s*=\s*(?:"([^"]+)"|([\w'(),.:?\-+/]+))!i;
-sub body_contains {
- croak 'Method "body_contains" not implemented by subclass';
-}
-
-sub body_size { croak 'Method "body_size" not implemented by subclass' }
+sub body_contains { croak 'Method "body_contains" not implemented by subclass'
}
+sub body_size { croak 'Method "body_size" not implemented by subclass' }
-sub boundary {
- (shift->headers->content_type // '') =~ $BOUNDARY_RE ? $1 // $2 : undef;
-}
+sub boundary { (shift->headers->content_type // '') =~ $BOUNDARY_RE ? $1 // $2
: undef }
sub charset {
my $type = shift->headers->content_type // '';
@@ -45,9 +40,7 @@
return looks_like_number $len && $len == $offset ? '' : undef;
}
-sub get_body_chunk {
- croak 'Method "get_body_chunk" not implemented by subclass';
-}
+sub get_body_chunk { croak 'Method "get_body_chunk" not implemented by
subclass' }
sub get_header_chunk { substr shift->_headers->{header_buffer}, shift, 131072 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Exception.pm
new/Mojolicious-8.52/lib/Mojo/Exception.pm
--- old/Mojolicious-8.51/lib/Mojo/Exception.pm 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/lib/Mojo/Exception.pm 2020-06-01 03:06:44.000000000
+0200
@@ -70,9 +70,7 @@
return $self;
}
-sub new {
- defined $_[1] ? shift->SUPER::new(message => shift) : shift->SUPER::new;
-}
+sub new { defined $_[1] ? shift->SUPER::new(message => shift) :
shift->SUPER::new }
sub raise {
my ($class, $err) = @_ > 1 ? (@_) : (__PACKAGE__, shift);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/IOLoop/Server.pm
new/Mojolicious-8.52/lib/Mojo/IOLoop/Server.pm
--- old/Mojolicious-8.51/lib/Mojo/IOLoop/Server.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojo/IOLoop/Server.pm 2020-06-01
03:13:49.000000000 +0200
@@ -18,9 +18,7 @@
$self->stop if $self->{handle} &&
$self->reactor;
}
-sub generate_port {
- IO::Socket::IP->new(Listen => 5, LocalAddr => '127.0.0.1')->sockport;
-}
+sub generate_port { IO::Socket::IP->new(Listen => 5, LocalAddr =>
'127.0.0.1')->sockport }
sub handle { shift->{handle} }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/IOLoop/Stream.pm
new/Mojolicious-8.52/lib/Mojo/IOLoop/Stream.pm
--- old/Mojolicious-8.51/lib/Mojo/IOLoop/Stream.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojo/IOLoop/Stream.pm 2020-06-01
03:14:51.000000000 +0200
@@ -64,10 +64,7 @@
return delete $self->{handle};
}
-sub stop {
- my $self = shift;
- $self->reactor->watch($self->{handle}, 0, $self->is_writing) if
$self->{handle} && !$self->{paused}++;
-}
+sub stop { $_[0]->reactor->watch($_[0]{handle}, 0, $_[0]->is_writing) if
$_[0]{handle} && !$_[0]{paused}++ }
sub timeout {
my ($self, $timeout) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Log.pm
new/Mojolicious-8.52/lib/Mojo/Log.pm
--- old/Mojolicious-8.51/lib/Mojo/Log.pm 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/lib/Mojo/Log.pm 2020-06-01 03:03:39.000000000
+0200
@@ -39,10 +39,7 @@
sub debug { 1 >= $LEVEL{$_[0]->level} ? _log(@_, 'debug') : $_[0] }
-sub context {
- my ($self, $str) = @_;
- return $self->new(parent => $self, context => $str, level => $self->level);
-}
+sub context { $_[0]->new(parent => $_[0], context => $_[1], level =>
$_[0]->level) }
sub error { 4 >= $LEVEL{$_[0]->level} ? _log(@_, 'error') : $_[0] }
sub fatal { 5 >= $LEVEL{$_[0]->level} ? _log(@_, 'fatal') : $_[0] }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Message/Request.pm
new/Mojolicious-8.52/lib/Mojo/Message/Request.pm
--- old/Mojolicious-8.51/lib/Mojo/Message/Request.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojo/Message/Request.pm 2020-06-01
03:13:08.000000000 +0200
@@ -96,9 +96,7 @@
return ($url->protocol || $url->base->protocol) eq 'https';
}
-sub is_xhr {
- (shift->headers->header('X-Requested-With') // '') =~ /XMLHttpRequest/i;
-}
+sub is_xhr { (shift->headers->header('X-Requested-With') // '') =~
/XMLHttpRequest/i }
sub param { shift->params->param(@_) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Message.pm
new/Mojolicious-8.52/lib/Mojo/Message.pm
--- old/Mojolicious-8.51/lib/Mojo/Message.pm 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/lib/Mojo/Message.pm 2020-06-01 03:31:34.000000000
+0200
@@ -79,9 +79,7 @@
sub every_cookie { shift->_cache('cookies', 1, @_) }
sub every_upload { shift->_cache('uploads', 1, @_) }
-sub extract_start_line {
- croak 'Method "extract_start_line" not implemented by subclass';
-}
+sub extract_start_line { croak 'Method "extract_start_line" not implemented by
subclass' }
sub finish {
my $self = shift;
@@ -121,9 +119,7 @@
return $self->fix_headers->content->get_header_chunk($offset);
}
-sub get_start_line_chunk {
- croak 'Method "get_start_line_chunk" not implemented by subclass';
-}
+sub get_start_line_chunk { croak 'Method "get_start_line_chunk" not
implemented by subclass' }
sub header_size { shift->fix_headers->content->header_size }
@@ -183,9 +179,7 @@
return $self;
}
-sub start_line_size {
- croak 'Method "start_line_size" not implemented by subclass';
-}
+sub start_line_size { croak 'Method "start_line_size" not implemented by
subclass' }
sub text {
my $self = shift;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Promise.pm
new/Mojolicious-8.52/lib/Mojo/Promise.pm
--- old/Mojolicious-8.51/lib/Mojo/Promise.pm 2020-05-31 14:12:14.000000000
+0200
+++ new/Mojolicious-8.52/lib/Mojo/Promise.pm 2020-06-01 02:57:47.000000000
+0200
@@ -3,7 +3,6 @@
use Carp qw(carp);
use Mojo::IOLoop;
-use Mojo::Util qw(deprecated);
use Scalar::Util qw(blessed);
has ioloop => sub { Mojo::IOLoop->singleton }, weak => 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Server/Morbo/Backend.pm
new/Mojolicious-8.52/lib/Mojo/Server/Morbo/Backend.pm
--- old/Mojolicious-8.51/lib/Mojo/Server/Morbo/Backend.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojo/Server/Morbo/Backend.pm 2020-06-01
03:12:37.000000000 +0200
@@ -6,9 +6,7 @@
has watch => sub { [qw(lib templates)] };
has watch_timeout => sub { $ENV{MOJO_MORBO_TIMEOUT} || 1 };
-sub modified_files {
- croak 'Method "modified_files" not implemented by subclass';
-}
+sub modified_files { croak 'Method "modified_files" not implemented by
subclass' }
1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojo/Util.pm
new/Mojolicious-8.52/lib/Mojo/Util.pm
--- old/Mojolicious-8.51/lib/Mojo/Util.pm 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/lib/Mojo/Util.pm 2020-06-01 03:10:39.000000000
+0200
@@ -402,9 +402,7 @@
return $k + (((PC_BASE - PC_TMIN + 1) * $delta) / ($delta + PC_SKEW));
}
-sub _encoding {
- $ENCODING{$_[0]} //= find_encoding($_[0]) // croak "Unknown encoding
'$_[0]'";
-}
+sub _encoding { $ENCODING{$_[0]} //= find_encoding($_[0]) // croak "Unknown
encoding '$_[0]'" }
sub _entity {
my ($point, $name, $attr) = @_;
@@ -423,9 +421,7 @@
}
# Supported on Perl 5.14+
-sub _global_destruction {
- defined ${^GLOBAL_PHASE} && ${^GLOBAL_PHASE} eq 'DESTRUCT';
-}
+sub _global_destruction { defined ${^GLOBAL_PHASE} && ${^GLOBAL_PHASE} eq
'DESTRUCT' }
sub _header {
my ($str, $cookie) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojolicious/Command.pm
new/Mojolicious-8.52/lib/Mojolicious/Command.pm
--- old/Mojolicious-8.51/lib/Mojolicious/Command.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojolicious/Command.pm 2020-06-02
18:30:19.000000000 +0200
@@ -99,8 +99,6 @@
# Magic here! :)
}
- 1;
-
=head1 SYNOPSIS
Usage: APPLICATION mycommand [OPTIONS]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Mojolicious-8.51/lib/Mojolicious/Plugin/DefaultHelpers.pm
new/Mojolicious-8.52/lib/Mojolicious/Plugin/DefaultHelpers.pm
--- old/Mojolicious-8.51/lib/Mojolicious/Plugin/DefaultHelpers.pm
2020-05-30 23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojolicious/Plugin/DefaultHelpers.pm
2020-06-01 03:21:25.000000000 +0200
@@ -82,10 +82,7 @@
return Mojo::ByteStream->new($hash->{$name} // '');
}
-sub _csrf_token {
- my $c = shift;
- return $c->session->{csrf_token} ||= hmac_sha1_sum($$ . steady_time . rand,
$c->app->secrets->[0]);
-}
+sub _csrf_token { $_[0]->session->{csrf_token} ||= hmac_sha1_sum($$ .
steady_time . rand, $_[0]->app->secrets->[0]) }
sub _current_route {
return '' unless my $route = shift->match->endpoint;
@@ -164,10 +161,7 @@
return $c->app->static->is_fresh($c, \%options);
}
-sub _log {
- my $c = shift;
- return $c->stash->{'mojo.log'} ||= $c->app->log->context('[' .
$c->req->request_id . ']');
-}
+sub _log { $_[0]->stash->{'mojo.log'} ||= $_[0]->app->log->context('[' .
$_[0]->req->request_id . ']') }
sub _proxy_method_p {
my ($method, $c) = (shift, shift);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojolicious/Static.pm
new/Mojolicious-8.52/lib/Mojolicious/Static.pm
--- old/Mojolicious-8.51/lib/Mojolicious/Static.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojolicious/Static.pm 2020-06-01
03:18:57.000000000 +0200
@@ -114,9 +114,7 @@
sub warmup {
my $self = shift;
my $index = $self->{index} = {};
- for my $class (reverse @{$self->classes}) {
- $index->{$_} = $class for keys %{data_section $class};
- }
+ for my $class (reverse @{$self->classes}) { $index->{$_} = $class for keys
%{data_section $class} }
}
sub _epoch { Mojo::Date->new(shift)->epoch }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojolicious/Validator.pm
new/Mojolicious-8.52/lib/Mojolicious/Validator.pm
--- old/Mojolicious-8.51/lib/Mojolicious/Validator.pm 2020-05-30
23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/lib/Mojolicious/Validator.pm 2020-06-01
03:19:15.000000000 +0200
@@ -30,9 +30,7 @@
return $self;
}
-sub validation {
- Mojolicious::Validator::Validation->new(validator => shift);
-}
+sub validation { Mojolicious::Validator::Validation->new(validator => shift) }
sub _equal_to {
my ($v, $name, $value, $to) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Mojolicious.pm
new/Mojolicious-8.52/lib/Mojolicious.pm
--- old/Mojolicious-8.51/lib/Mojolicious.pm 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/lib/Mojolicious.pm 2020-05-31 14:29:40.000000000
+0200
@@ -58,7 +58,7 @@
has validator => sub { Mojolicious::Validator->new };
our $CODENAME = 'Supervillain';
-our $VERSION = '8.51';
+our $VERSION = '8.52';
sub BUILD_DYNAMIC {
my ($class, $method, $dyn_methods) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/lib/Test/Mojo.pm
new/Mojolicious-8.52/lib/Test/Mojo.pm
--- old/Mojolicious-8.51/lib/Test/Mojo.pm 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/lib/Test/Mojo.pm 2020-06-01 03:28:00.000000000
+0200
@@ -71,20 +71,17 @@
sub content_type_is {
my ($self, $type, $desc) = @_;
- $desc = _desc($desc, "Content-Type: $type");
- return $self->test('is', $self->tx->res->headers->content_type, $type,
$desc);
+ return $self->test('is', $self->tx->res->headers->content_type, $type,
_desc($desc, "Content-Type: $type"));
}
sub content_type_isnt {
my ($self, $type, $desc) = @_;
- $desc = _desc($desc, "not Content-Type: $type");
- return $self->test('isnt', $self->tx->res->headers->content_type, $type,
$desc);
+ return $self->test('isnt', $self->tx->res->headers->content_type, $type,
_desc($desc, "not Content-Type: $type"));
}
sub content_type_like {
my ($self, $regex, $desc) = @_;
- $desc = _desc($desc, 'Content-Type is similar');
- return $self->test('like', $self->tx->res->headers->content_type, $regex,
$desc);
+ return $self->test('like', $self->tx->res->headers->content_type, $regex,
_desc($desc, 'Content-Type is similar'));
}
sub content_type_unlike {
@@ -114,8 +111,7 @@
sub element_exists_not {
my ($self, $selector, $desc) = @_;
- $desc = _desc($desc, qq{no element for selector "$selector"});
- return $self->test('ok', !$self->tx->res->dom->at($selector), $desc);
+ return $self->test('ok', !$self->tx->res->dom->at($selector), _desc($desc,
qq{no element for selector "$selector"}));
}
sub finish_ok {
@@ -137,20 +133,17 @@
sub header_exists {
my ($self, $name, $desc) = @_;
- $desc = _desc($desc, qq{header "$name" exists});
- return $self->test('ok', !!@{$self->tx->res->headers->every_header($name)},
$desc);
+ return $self->test('ok', !!@{$self->tx->res->headers->every_header($name)},
_desc($desc, qq{header "$name" exists}));
}
sub header_exists_not {
my ($self, $name, $desc) = @_;
- $desc = _desc($desc, qq{no "$name" header});
- return $self->test('ok', !@{$self->tx->res->headers->every_header($name)},
$desc);
+ return $self->test('ok', !@{$self->tx->res->headers->every_header($name)},
_desc($desc, qq{no "$name" header}));
}
sub header_is {
my ($self, $name, $value, $desc) = @_;
- $desc = _desc($desc, "$name: " . ($value // ''));
- return $self->test('is', $self->tx->res->headers->header($name), $value,
$desc);
+ return $self->test('is', $self->tx->res->headers->header($name), $value,
_desc($desc, "$name: " . ($value // '')));
}
sub header_isnt {
@@ -167,8 +160,7 @@
sub header_unlike {
my ($self, $name, $regex, $desc) = @_;
- $desc = _desc($desc, "$name is not similar");
- return $self->test('unlike', $self->tx->res->headers->header($name), $regex,
$desc);
+ return $self->test('unlike', $self->tx->res->headers->header($name), $regex,
_desc($desc, "$name is not similar"));
}
sub json_has {
@@ -197,21 +189,18 @@
sub json_message_has {
my ($self, $p, $desc) = @_;
- $desc = _desc($desc, qq{has value for JSON Pointer "$p"});
- return $self->test('ok', $self->_json(contains => $p), $desc);
+ return $self->test('ok', $self->_json(contains => $p), _desc($desc, qq{has
value for JSON Pointer "$p"}));
}
sub json_message_hasnt {
my ($self, $p, $desc) = @_;
- $desc = _desc($desc, qq{has no value for JSON Pointer "$p"});
- return $self->test('ok', !$self->_json(contains => $p), $desc);
+ return $self->test('ok', !$self->_json(contains => $p), _desc($desc, qq{has
no value for JSON Pointer "$p"}));
}
sub json_message_is {
my $self = shift;
my ($p, $data) = @_ > 1 ? (shift, shift) : ('', shift);
- my $desc = _desc(shift, qq{exact match for JSON Pointer "$p"});
- return $self->test('is_deeply', $self->_json(get => $p), $data, $desc);
+ return $self->test('is_deeply', $self->_json(get => $p), $data, _desc(shift,
qq{exact match for JSON Pointer "$p"}));
}
sub json_message_like {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/t/mojo/asset.t
new/Mojolicious-8.52/t/mojo/asset.t
--- old/Mojolicious-8.51/t/mojo/asset.t 2020-05-30 23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/t/mojo/asset.t 2020-06-01 14:07:23.000000000 +0200
@@ -7,224 +7,249 @@
use Mojo::Asset::Memory;
use Mojo::File qw(path tempdir);
-# File asset
-my $file = Mojo::Asset::File->new;
-is $file->size, 0, 'file is empty';
-is $file->mtime, (stat $file->handle)[9], 'right mtime';
-is $file->slurp, '', 'file is empty';
-$file->add_chunk('abc');
-is $file->contains('abc'), 0, '"abc" at position 0';
-is $file->contains('bc'), 1, '"bc" at position 1';
-is $file->contains('db'), -1, 'does not contain "db"';
-is $file->size, 3, 'right size';
-is $file->mtime, (stat $file->handle)[9], 'right mtime';
-is $file->to_file, $file, 'same object';
-
-# Cleanup
-my $path = $file->path;
-ok -e $path, 'temporary file exists';
-undef $file;
-ok !-e $path, 'temporary file has been cleaned up';
-
-# Memory asset
-my $mem = Mojo::Asset::Memory->new;
-$mem->add_chunk('abc');
-is $mem->contains('abc'), 0, '"abc" at position 0';
-is $mem->contains('bc'), 1, '"bc" at position 1';
-is $mem->contains('db'), -1, 'does not contain "db"';
-is $mem->size, 3, 'right size';
-is $mem->mtime, $^T, 'right mtime';
-is $mem->mtime, Mojo::Asset::Memory->new->mtime, 'same mtime';
-my $mtime = $mem->mtime;
-is $mem->mtime($mtime + 23)->mtime, $mtime + 23, 'right mtime';
-
-# Asset upgrade from memory to file
-$mem = Mojo::Asset::Memory->new;
-$mem->add_chunk('abcdef');
-isa_ok $mem->to_file, 'Mojo::Asset::File', 'right class';
-is $mem->to_file->slurp, $mem->slurp, 'same content';
-$file = $mem->to_file;
-$path = $file->path;
-ok -e $path, 'file exists';
-undef $file;
-ok !-e $path, 'file has been cleaned up';
-
-# Empty file asset
-$file = Mojo::Asset::File->new;
-is $file->size, 0, 'asset is empty';
-is $file->get_chunk(0), '', 'no content';
-is $file->slurp, '', 'no content';
-is $file->contains('a'), -1, 'does not contain "a"';
-
-# Empty memory asset
-$mem = Mojo::Asset::Memory->new;
-is $mem->size, 0, 'asset is empty';
-is $mem->get_chunk(0), '', 'no content';
-is $mem->slurp, '', 'no content';
-ok !$mem->is_range, 'no range';
-is $mem->contains('a'), -1, 'does not contain "a"';
-
-# File asset range support (a[bcdefabc])
-$file = Mojo::Asset::File->new(start_range => 1);
-ok $file->is_range, 'has range';
-$file->add_chunk('abcdefabc');
-is $file->contains('bcdef'), 0, '"bcdef" at position 0';
-is $file->contains('cdef'), 1, '"cdef" at position 1';
-is $file->contains('abc'), 5, '"abc" at position 5';
-is $file->contains('db'), -1, 'does not contain "db"';
-
-# Memory asset range support (a[bcdefabc])
-$mem = Mojo::Asset::Memory->new(start_range => 1);
-ok $mem->is_range, 'has range';
-$mem->add_chunk('abcdefabc');
-is $mem->contains('bcdef'), 0, '"bcdef" at position 0';
-is $mem->contains('cdef'), 1, '"cdef" at position 1';
-is $mem->contains('abc'), 5, '"abc" at position 5';
-is $mem->contains('db'), -1, 'does not contain "db"';
-
-# File asset range support (ab[cdefghi]jk)
-$file = Mojo::Asset::File->new(start_range => 2, end_range => 8);
-ok $file->is_range, 'has range';
-$file->add_chunk('abcdefghijk');
-is $file->contains('cdefghi'), 0, '"cdefghi" at position 0';
-is $file->contains('fghi'), 3, '"fghi" at position 3';
-is $file->contains('f'), 3, '"f" at position 3';
-is $file->contains('hi'), 5, '"hi" at position 5';
-is $mem->contains('ij'), -1, 'does not contain "ij"';
-is $file->contains('db'), -1, 'does not contain "db"';
-is $file->get_chunk(0), 'cdefghi', 'chunk from position 0';
-is $file->get_chunk(1), 'defghi', 'chunk from position 1';
-is $file->get_chunk(5), 'hi', 'chunk from position 5';
-is $file->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
-is $file->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
-is $file->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
-is $file->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
-
-# Memory asset range support (ab[cdefghi]jk)
-$mem = Mojo::Asset::Memory->new(start_range => 2, end_range => 8);
-ok $mem->is_range, 'has range';
-$mem->add_chunk('abcdefghijk');
-is $mem->contains('cdefghi'), 0, '"cdefghi" at position 0';
-is $mem->contains('fghi'), 3, '"fghi" at position 3';
-is $mem->contains('f'), 3, '"f" at position 3';
-is $mem->contains('hi'), 5, '"hi" at position 5';
-is $mem->contains('ij'), -1, 'does not contain "ij"';
-is $mem->contains('db'), -1, 'does not contain "db"';
-is $mem->get_chunk(0), 'cdefghi', 'chunk from position 0';
-is $mem->get_chunk(1), 'defghi', 'chunk from position 1';
-is $mem->get_chunk(5), 'hi', 'chunk from position 5';
-is $mem->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
-is $mem->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
-is $mem->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
-is $mem->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
-
-# Huge file asset
-$file = Mojo::Asset::File->new;
-ok !$file->is_range, 'no range';
-$file->add_chunk('a' x 131072);
-$file->add_chunk('b');
-$file->add_chunk('c' x 131072);
-$file->add_chunk('ddd');
-is $file->contains('a'), 0, '"a" at position 0';
-is $file->contains('b'), 131072, '"b" at position 131072';
-is $file->contains('c'), 131073, '"c" at position 131073';
-is $file->contains('abc'), 131071, '"abc" at position 131071';
-is $file->contains('ccdd'), 262143, '"ccdd" at position 262143';
-is $file->contains('dd'), 262145, '"dd" at position 262145';
-is $file->contains('ddd'), 262145, '"ddd" at position 262145';
-is $file->contains('e'), -1, 'does not contain "e"';
-is $file->contains('a' x 131072), 0, '"a" x 131072 at position 0';
-is $file->contains('c' x 131072), 131073, '"c" x 131072 at position 131073';
-is $file->contains('b' . ('c' x 131072) . "ddd"), 131072, '"b" . ("c" x
131072) . "ddd" at position 131072';
-
-# Huge file asset with range
-$file = Mojo::Asset::File->new(start_range => 1, end_range => 262146);
-$file->add_chunk('a' x 131072);
-$file->add_chunk('b');
-$file->add_chunk('c' x 131072);
-$file->add_chunk('ddd');
-is $file->contains('a'), 0, '"a" at position 0';
-is $file->contains('b'), 131071, '"b" at position 131071';
-is $file->contains('c'), 131072, '"c" at position 131072';
-is $file->contains('abc'), 131070, '"abc" at position 131070';
-is $file->contains('ccdd'), 262142, '"ccdd" at position 262142';
-is $file->contains('dd'), 262144, '"dd" at position 262144';
-is $file->contains('ddd'), -1, 'does not contain "ddd"';
-is $file->contains('b' . ('c' x 131072) . 'ddd'), -1, 'does not contain "b" .
("c" x 131072) . "ddd"';
-
-# Move memory asset to file
-$mem = Mojo::Asset::Memory->new->add_chunk('abc');
-my $tmp = Mojo::Asset::File->new->add_chunk('x');
-$path = $tmp->path;
-ok -e $path, 'file exists';
-undef $tmp;
-ok !-e $path, 'file has been cleaned up';
-is $mem->move_to($path)->slurp, 'abc', 'right content';
-ok -e $path, 'file exists';
-ok unlink($path), 'unlinked file';
-ok !-e $path, 'file has been cleaned up';
-is(Mojo::Asset::Memory->new->move_to($path)->slurp, '', 'no content');
-ok -e $path, 'file exists';
-ok unlink($path), 'unlinked file';
-ok !-e $path, 'file has been cleaned up';
-
-# Move file asset to file
-$file = Mojo::Asset::File->new;
-$file->add_chunk('bcd');
-$tmp = Mojo::Asset::File->new;
-$tmp->add_chunk('x');
-isnt $file->path, $tmp->path, 'different paths';
-$path = $tmp->path;
-ok -e $path, 'file exists';
-undef $tmp;
-ok !-e $path, 'file has been cleaned up';
-is $file->move_to($path)->slurp, 'bcd', 'right content';
-undef $file;
-ok -e $path, 'file exists';
-ok unlink($path), 'unlinked file';
-ok !-e $path, 'file has been cleaned up';
-is(Mojo::Asset::File->new->move_to($path)->slurp, '', 'no content');
-ok -e $path, 'file exists';
-ok unlink($path), 'unlinked file';
-ok !-e $path, 'file has been cleaned up';
-
-# Upgrade
-my $asset = Mojo::Asset::Memory->new(max_memory_size => 5, auto_upgrade => 1);
-my $upgrade;
-$asset->on(upgrade => sub { $upgrade++ });
-$asset = $asset->add_chunk('lala');
-ok !$upgrade, 'upgrade event has not been emitted';
-ok !$asset->is_file, 'stored in memory';
-$asset = $asset->add_chunk('lala');
-is $upgrade, 1, 'upgrade event has been emitted once';
-ok $asset->is_file, 'stored in file';
-$asset = $asset->add_chunk('lala');
-is $upgrade, 1, 'upgrade event was not emitted again';
-ok $asset->is_file, 'stored in file';
-is $asset->slurp, 'lalalalalala', 'right content';
-ok $asset->cleanup, 'file will be cleaned up';
-$asset = Mojo::Asset::Memory->new(max_memory_size => 5);
-$asset = $asset->add_chunk('lala');
-ok !$asset->is_file, 'stored in memory';
-$asset = $asset->add_chunk('lala');
-ok !$asset->is_file, 'stored in memory';
+subtest 'File asset' => sub {
+ my $file = Mojo::Asset::File->new;
+ is $file->size, 0, 'file is empty';
+ is $file->mtime, (stat $file->handle)[9], 'right mtime';
+ is $file->slurp, '', 'file is empty';
+ $file->add_chunk('abc');
+ is $file->contains('abc'), 0, '"abc" at position 0';
+ is $file->contains('bc'), 1, '"bc" at position 1';
+ is $file->contains('db'), -1, 'does not contain "db"';
+ is $file->size, 3, 'right size';
+ is $file->mtime, (stat $file->handle)[9], 'right mtime';
+ is $file->to_file, $file, 'same object';
-# Temporary directory
-{
+ my $path = $file->path;
+ ok -e $path, 'temporary file exists';
+ undef $file;
+ ok !-e $path, 'temporary file has been cleaned up';
+};
+
+subtest 'Memory asset' => sub {
+ my $mem = Mojo::Asset::Memory->new;
+ $mem->add_chunk('abc');
+ is $mem->contains('abc'), 0, '"abc" at position 0';
+ is $mem->contains('bc'), 1, '"bc" at position 1';
+ is $mem->contains('db'), -1, 'does not contain "db"';
+ is $mem->size, 3, 'right size';
+ is $mem->mtime, $^T, 'right mtime';
+ is $mem->mtime, Mojo::Asset::Memory->new->mtime, 'same mtime';
+ my $mtime = $mem->mtime;
+ is $mem->mtime($mtime + 23)->mtime, $mtime + 23, 'right mtime';
+};
+
+subtest 'Asset upgrade from memory to file' => sub {
+ my $mem = Mojo::Asset::Memory->new;
+ $mem->add_chunk('abcdef');
+ isa_ok $mem->to_file, 'Mojo::Asset::File', 'right class';
+ is $mem->to_file->slurp, $mem->slurp, 'same content';
+ my $file = $mem->to_file;
+ my $path = $file->path;
+ ok -e $path, 'file exists';
+ undef $file;
+ ok !-e $path, 'file has been cleaned up';
+};
+
+subtest 'Empty file asset' => sub {
+ my $file = Mojo::Asset::File->new;
+ is $file->size, 0, 'asset is empty';
+ is $file->get_chunk(0), '', 'no content';
+ is $file->slurp, '', 'no content';
+ is $file->contains('a'), -1, 'does not contain "a"';
+};
+
+subtest 'Empty memory asset' => sub {
+ my $mem = Mojo::Asset::Memory->new;
+ is $mem->size, 0, 'asset is empty';
+ is $mem->get_chunk(0), '', 'no content';
+ is $mem->slurp, '', 'no content';
+ ok !$mem->is_range, 'no range';
+ is $mem->contains('a'), -1, 'does not contain "a"';
+};
+
+subtest 'File asset range support (a[bcdefabc])' => sub {
+ my $file = Mojo::Asset::File->new(start_range => 1);
+ ok $file->is_range, 'has range';
+ $file->add_chunk('abcdefabc');
+ is $file->contains('bcdef'), 0, '"bcdef" at position 0';
+ is $file->contains('cdef'), 1, '"cdef" at position 1';
+ is $file->contains('abc'), 5, '"abc" at position 5';
+ is $file->contains('db'), -1, 'does not contain "db"';
+};
+
+subtest 'Memory asset range support (a[bcdefabc])' => sub {
+ my $mem = Mojo::Asset::Memory->new(start_range => 1);
+ ok $mem->is_range, 'has range';
+ $mem->add_chunk('abcdefabc');
+ is $mem->contains('bcdef'), 0, '"bcdef" at position 0';
+ is $mem->contains('cdef'), 1, '"cdef" at position 1';
+ is $mem->contains('abc'), 5, '"abc" at position 5';
+ is $mem->contains('db'), -1, 'does not contain "db"';
+};
+
+subtest 'File asset range support (ab[cdefghi]jk)' => sub {
+ my $file = Mojo::Asset::File->new(start_range => 2, end_range => 8);
+ ok $file->is_range, 'has range';
+ $file->add_chunk('abcdefghijk');
+ is $file->contains('cdefghi'), 0, '"cdefghi" at position 0';
+ is $file->contains('fghi'), 3, '"fghi" at position 3';
+ is $file->contains('f'), 3, '"f" at position 3';
+ is $file->contains('hi'), 5, '"hi" at position 5';
+ is $file->contains('db'), -1, 'does not contain "db"';
+ is $file->get_chunk(0), 'cdefghi', 'chunk from position 0';
+ is $file->get_chunk(1), 'defghi', 'chunk from position 1';
+ is $file->get_chunk(5), 'hi', 'chunk from position 5';
+ is $file->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
+ is $file->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
+ is $file->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
+ is $file->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
+};
+
+subtest 'Memory asset range support (ab[cdefghi]jk)' => sub {
+ my $mem = Mojo::Asset::Memory->new(start_range => 2, end_range => 8);
+ ok $mem->is_range, 'has range';
+ $mem->add_chunk('abcdefghijk');
+ is $mem->contains('cdefghi'), 0, '"cdefghi" at position 0';
+ is $mem->contains('fghi'), 3, '"fghi" at position 3';
+ is $mem->contains('f'), 3, '"f" at position 3';
+ is $mem->contains('hi'), 5, '"hi" at position 5';
+ is $mem->contains('ij'), -1, 'does not contain "ij"';
+ is $mem->contains('db'), -1, 'does not contain "db"';
+ is $mem->get_chunk(0), 'cdefghi', 'chunk from position 0';
+ is $mem->get_chunk(1), 'defghi', 'chunk from position 1';
+ is $mem->get_chunk(5), 'hi', 'chunk from position 5';
+ is $mem->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
+ is $mem->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
+ is $mem->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
+ is $mem->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
+};
+
+subtest 'Huge file asset' => sub {
+ my $file = Mojo::Asset::File->new;
+ ok !$file->is_range, 'no range';
+ $file->add_chunk('a' x 131072);
+ $file->add_chunk('b');
+ $file->add_chunk('c' x 131072);
+ $file->add_chunk('ddd');
+ is $file->contains('a'), 0, '"a" at position 0';
+ is $file->contains('b'), 131072, '"b" at position 131072';
+ is $file->contains('c'), 131073, '"c" at position 131073';
+ is $file->contains('abc'), 131071, '"abc" at position 131071';
+ is $file->contains('ccdd'), 262143, '"ccdd" at position 262143';
+ is $file->contains('dd'), 262145, '"dd" at position 262145';
+ is $file->contains('ddd'), 262145, '"ddd" at position 262145';
+ is $file->contains('e'), -1, 'does not contain "e"';
+ is $file->contains('a' x 131072), 0, '"a" x 131072 at position 0';
+ is $file->contains('c' x 131072), 131073, '"c" x 131072 at position 131073';
+ is $file->contains('b' . ('c' x 131072) . "ddd"), 131072, '"b" . ("c" x
131072) . "ddd" at position 131072';
+};
+
+subtest 'Huge file asset with range' => sub {
+ my $file = Mojo::Asset::File->new(start_range => 1, end_range => 262146);
+ $file->add_chunk('a' x 131072);
+ $file->add_chunk('b');
+ $file->add_chunk('c' x 131072);
+ $file->add_chunk('ddd');
+ is $file->contains('a'), 0, '"a" at position 0';
+ is $file->contains('b'), 131071, '"b" at position 131071';
+ is $file->contains('c'), 131072, '"c" at position 131072';
+ is $file->contains('abc'), 131070, '"abc" at position 131070';
+ is $file->contains('ccdd'), 262142, '"ccdd" at position 262142';
+ is $file->contains('dd'), 262144, '"dd" at position 262144';
+ is $file->contains('ddd'), -1, 'does not contain "ddd"';
+ is $file->contains('b' . ('c' x 131072) . 'ddd'), -1, 'does not contain "b"
. ("c" x 131072) . "ddd"';
+};
+
+subtest 'Move memory asset to file' => sub {
+ my $mem = Mojo::Asset::Memory->new->add_chunk('abc');
+ my $tmp = Mojo::Asset::File->new->add_chunk('x');
+ my $path = $tmp->path;
+ ok -e $path, 'file exists';
+ undef $tmp;
+ ok !-e $path, 'file has been cleaned up';
+ is $mem->move_to($path)->slurp, 'abc', 'right content';
+ ok -e $path, 'file exists';
+ ok unlink($path), 'unlinked file';
+ ok !-e $path, 'file has been cleaned up';
+ is(Mojo::Asset::Memory->new->move_to($path)->slurp, '', 'no content');
+ ok -e $path, 'file exists';
+ ok unlink($path), 'unlinked file';
+ ok !-e $path, 'file has been cleaned up';
+};
+
+subtest 'Move file asset to file' => sub {
+ my $file = Mojo::Asset::File->new;
+ $file->add_chunk('bcd');
+ my $tmp = Mojo::Asset::File->new;
+ $tmp->add_chunk('x');
+ isnt $file->path, $tmp->path, 'different paths';
+ my $path = $tmp->path;
+ ok -e $path, 'file exists';
+ undef $tmp;
+ ok !-e $path, 'file has been cleaned up';
+ is $file->move_to($path)->slurp, 'bcd', 'right content';
+ undef $file;
+ ok -e $path, 'file exists';
+ ok unlink($path), 'unlinked file';
+ ok !-e $path, 'file has been cleaned up';
+ is(Mojo::Asset::File->new->move_to($path)->slurp, '', 'no content');
+ ok -e $path, 'file exists';
+ ok unlink($path), 'unlinked file';
+ ok !-e $path, 'file has been cleaned up';
+};
+
+subtest 'Upgrade' => sub {
+ my $asset = Mojo::Asset::Memory->new(max_memory_size => 5, auto_upgrade =>
1);
+ my $upgrade;
+ $asset->on(upgrade => sub { $upgrade++ });
+ $asset = $asset->add_chunk('lala');
+ ok !$upgrade, 'upgrade event has not been emitted';
+ ok !$asset->is_file, 'stored in memory';
+ $asset = $asset->add_chunk('lala');
+ is $upgrade, 1, 'upgrade event has been emitted once';
+ ok $asset->is_file, 'stored in file';
+ $asset = $asset->add_chunk('lala');
+ is $upgrade, 1, 'upgrade event was not emitted again';
+ ok $asset->is_file, 'stored in file';
+ is $asset->slurp, 'lalalalalala', 'right content';
+ ok $asset->cleanup, 'file will be cleaned up';
+ $asset = Mojo::Asset::Memory->new(max_memory_size => 5);
+ $asset = $asset->add_chunk('lala');
+ ok !$asset->is_file, 'stored in memory';
+ $asset = $asset->add_chunk('lala');
+ ok !$asset->is_file, 'stored in memory';
+};
+
+subtest 'Change temporary directory during upgrade' => sub {
+ my $tmpdir = tempdir;
+ my $mem = Mojo::Asset::Memory->new(auto_upgrade => 1, max_memory_size =>
10);
+ $mem->on(
+ upgrade => sub {
+ my ($mem, $file) = @_;
+ $file->tmpdir($tmpdir);
+ }
+ );
+ my $file = $mem->add_chunk('aaaaaaaaaaa');
+ ok $file->is_file, 'stored in file';
+ is $file->slurp, 'aaaaaaaaaaa', 'right content';
+ is path($file->path)->dirname, $tmpdir, 'right directory';
+};
+
+subtest 'Temporary directory' => sub {
local $ENV{MOJO_TMPDIR} = my $tmpdir = tempdir;
- $file = Mojo::Asset::File->new;
+ my $file = Mojo::Asset::File->new;
is($file->tmpdir, $tmpdir, 'same directory');
$file->add_chunk('works!');
is $file->slurp, 'works!', 'right content';
is path($file->path)->dirname, $tmpdir, 'same directory';
-}
+};
-# Custom temporary file
-{
+subtest 'Custom temporary file' => sub {
my $tmpdir = tempdir;
my $path = $tmpdir->child('test.file');
ok !-e $path, 'file does not exist';
- $file = Mojo::Asset::File->new(path => $path);
+ my $file = Mojo::Asset::File->new(path => $path);
is $file->path, $path, 'right path';
ok !-e $path, 'file still does not exist';
$file->add_chunk('works!');
@@ -232,61 +257,63 @@
is $file->slurp, 'works!', 'right content';
undef $file;
ok !-e $path, 'file has been cleaned up';
-}
+};
-# Temporary file without cleanup
-$file = Mojo::Asset::File->new(cleanup => 0)->add_chunk('test');
-ok $file->is_file, 'stored in file';
-is $file->slurp, 'test', 'right content';
-is $file->size, 4, 'right size';
-is $file->mtime, (stat $file->handle)[9], 'right mtime';
-is $file->contains('es'), 1, '"es" at position 1';
-$path = $file->path;
-undef $file;
-ok -e $path, 'file exists';
-ok unlink($path), 'unlinked file';
-ok !-e $path, 'file has been cleaned up';
+subtest 'Temporary file without cleanup' => sub {
+ my $file = Mojo::Asset::File->new(cleanup => 0)->add_chunk('test');
+ ok $file->is_file, 'stored in file';
+ is $file->slurp, 'test', 'right content';
+ is $file->size, 4, 'right size';
+ is $file->mtime, (stat $file->handle)[9], 'right mtime';
+ is $file->contains('es'), 1, '"es" at position 1';
+ my $path = $file->path;
+ undef $file;
+ ok -e $path, 'file exists';
+ ok unlink($path), 'unlinked file';
+ ok !-e $path, 'file has been cleaned up';
+};
-# Incomplete write
-{
+subtest 'Incomplete write' => sub {
no warnings 'redefine';
local *IO::Handle::syswrite = sub { $! = 0; 2 };
eval { Mojo::Asset::File->new->add_chunk('test') };
like $@, qr/Can't write to asset: .*/, 'right error';
-}
+};
-# Forked process
+subtest 'Forked process' => sub {
SKIP: {
- skip 'Real fork is required!', 5 if $Config{d_pseudofork};
- $file = Mojo::Asset::File->new->add_chunk('Fork test!');
- $path = $file->path;
- ok -e $path, 'file exists';
- is $file->slurp, 'Fork test!', 'right content';
- croak "Can't fork: $!" unless defined(my $pid = fork);
- exit 0 unless $pid;
- waitpid $pid, 0 if $pid;
- ok -e $path, 'file still exists';
- is $file->slurp, 'Fork test!', 'right content';
- undef $file;
- ok !-e $path, 'file has been cleaned up';
-}
-
-# Abstract methods
-eval { Mojo::Asset->add_chunk };
-like $@, qr/Method "add_chunk" not implemented by subclass/, 'right error';
-eval { Mojo::Asset->contains };
-like $@, qr/Method "contains" not implemented by subclass/, 'right error';
-eval { Mojo::Asset->get_chunk };
-like $@, qr/Method "get_chunk" not implemented by subclass/, 'right error';
-eval { Mojo::Asset->move_to };
-like $@, qr/Method "move_to" not implemented by subclass/, 'right error';
-eval { Mojo::Asset->mtime };
-like $@, qr/Method "mtime" not implemented by subclass/, 'right error';
-eval { Mojo::Asset->size };
-like $@, qr/Method "size" not implemented by subclass/, 'right error';
-eval { Mojo::Asset->slurp };
-like $@, qr/Method "slurp" not implemented by subclass/, 'right error';
-eval { Mojo::Asset->to_file };
-like $@, qr/Method "to_file" not implemented by subclass/, 'right error';
+ skip 'Real fork is required!', 5 if $Config{d_pseudofork};
+ my $file = Mojo::Asset::File->new->add_chunk('Fork test!');
+ my $path = $file->path;
+ ok -e $path, 'file exists';
+ is $file->slurp, 'Fork test!', 'right content';
+ croak "Can't fork: $!" unless defined(my $pid = fork);
+ exit 0 unless $pid;
+ waitpid $pid, 0 if $pid;
+ ok -e $path, 'file still exists';
+ is $file->slurp, 'Fork test!', 'right content';
+ undef $file;
+ ok !-e $path, 'file has been cleaned up';
+ }
+};
+
+subtest 'Abstract methods' => sub {
+ eval { Mojo::Asset->add_chunk };
+ like $@, qr/Method "add_chunk" not implemented by subclass/, 'right error';
+ eval { Mojo::Asset->contains };
+ like $@, qr/Method "contains" not implemented by subclass/, 'right error';
+ eval { Mojo::Asset->get_chunk };
+ like $@, qr/Method "get_chunk" not implemented by subclass/, 'right error';
+ eval { Mojo::Asset->move_to };
+ like $@, qr/Method "move_to" not implemented by subclass/, 'right error';
+ eval { Mojo::Asset->mtime };
+ like $@, qr/Method "mtime" not implemented by subclass/, 'right error';
+ eval { Mojo::Asset->size };
+ like $@, qr/Method "size" not implemented by subclass/, 'right error';
+ eval { Mojo::Asset->slurp };
+ like $@, qr/Method "slurp" not implemented by subclass/, 'right error';
+ eval { Mojo::Asset->to_file };
+ like $@, qr/Method "to_file" not implemented by subclass/, 'right error';
+};
done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/t/mojo/date.t
new/Mojolicious-8.52/t/mojo/date.t
--- old/Mojolicious-8.51/t/mojo/date.t 2020-05-30 23:40:49.000000000 +0200
+++ new/Mojolicious-8.52/t/mojo/date.t 2020-06-02 11:23:13.000000000 +0200
@@ -3,72 +3,82 @@
use Test::More;
use Mojo::Date;
-# RFC 822/1123
-my $date = Mojo::Date->new('Sun, 06 Nov 1994 08:49:37 GMT');
-is $date->epoch, 784111777, 'right epoch value';
-$date = Mojo::Date->new('Fri, 13 May 2011 10:00:24 GMT');
-is $date->epoch, 1305280824, 'right epoch value';
-
-# RFC 850/1036
-is(Mojo::Date->new('Sunday, 06-Nov-94 08:49:37 GMT')->epoch, 784111777,
'right epoch value');
-is(Mojo::Date->new('Friday, 13-May-11 10:00:24 GMT')->epoch, 1305280824,
'right epoch value');
-
-# RFC 3339
-is(Mojo::Date->new('2014-08-20T20:45:00')->epoch, 1408567500,
'right epoch value');
-is(Mojo::Date->new(1408567500)->to_datetime,
'2014-08-20T20:45:00Z', 'right format');
-is(Mojo::Date->new('2014-08-20T20:45:00.01')->epoch, 1408567500.01,
'right epoch value');
-is(Mojo::Date->new('2014-08-20T20:45:00-00:46')->epoch, 1408570260,
'right epoch value');
-is(Mojo::Date->new(1408570260)->to_datetime,
'2014-08-20T21:31:00Z', 'right format');
-is(Mojo::Date->new('2014-08-20t20:45:00-01:46')->epoch, 1408573860,
'right epoch value');
-is(Mojo::Date->new('2014-08-20t20:45:00+01:46')->epoch, 1408561140,
'right epoch value');
-is(Mojo::Date->new(1408561140)->to_datetime,
'2014-08-20T18:59:00Z', 'right format');
-is(Mojo::Date->new('1994-11-06T08:49:37Z')->epoch, 784111777,
'right epoch value');
-is(Mojo::Date->new('1994-11-06t08:49:37.33z')->epoch, 784111777.33,
'right epoch value');
-is(Mojo::Date->new(784111777.33)->to_datetime,
'1994-11-06T08:49:37.33Z', 'right format');
-
-# Special cases
-is(Mojo::Date->new('Sun , 06-Nov-1994 08:49:37 UTC')->epoch, 784111777,
'right epoch value');
-is(Mojo::Date->new('Sunday,06 Nov 94 08:49:37 UTC')->epoch, 784111777,
'right epoch value');
-is(Mojo::Date->new('Sunday 06 Nov 94 08:49:37UTC')->epoch, 784111777,
'right epoch value');
-is(Mojo::Date->new('2014-08-20 20:45:00')->epoch, 1408567500,
'right epoch value');
-
-# ANSI C asctime()
-is(Mojo::Date->new('Sun Nov 6 08:49:37 1994')->epoch, 784111777, 'right
epoch value');
-is(Mojo::Date->new('Fri May 13 10:00:24 2011')->epoch, 1305280824, 'right
epoch value');
-
-# Invalid string
-is(Mojo::Date->new('')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('123 abc')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('abc')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('Xxx, 00 Xxx 0000 00:00:00 XXX')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('Sun, 06 Nov 1994 08:49:37 GMT GARBAGE')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('Sunday, 06-Nov-94 08:49:37 GMT GARBAGE')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('Sun Nov 6 08:49:37 1994 GARBAGE')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('Fri, 75 May 2011 99:99:99 GMT')->epoch, undef,
'no epoch value');
-is(Mojo::Date->new('0000-00-00T00:00:00+01:00')->epoch, undef,
'no epoch value');
-
-# to_string
-$date = Mojo::Date->new(784111777);
-is "$date", 'Sun, 06 Nov 1994 08:49:37 GMT', 'right format';
-$date = Mojo::Date->new(1305280824);
-is $date->to_string, 'Fri, 13 May 2011 10:00:24 GMT', 'right format';
-$date = Mojo::Date->new('1305280824.23');
-is $date->to_string, 'Fri, 13 May 2011 10:00:24 GMT', 'right format';
-
-# Current time roundtrips
-my $before = time;
-ok(Mojo::Date->new(Mojo::Date->new->to_string)->epoch >= $before,
'successful roundtrip');
-ok(Mojo::Date->new(Mojo::Date->new->to_datetime)->epoch >= $before,
'successful roundtrip');
-
-# Zero time checks
-$date = Mojo::Date->new(0);
-is $date->epoch, 0, 'right epoch value';
-is "$date", 'Thu, 01 Jan 1970 00:00:00 GMT', 'right format';
-is(Mojo::Date->new('Thu, 01 Jan 1970 00:00:00 GMT')->epoch, 0, 'right epoch
value');
-
-# No epoch value
-$date = Mojo::Date->new;
-ok $date->parse('Mon, 01 Jan 1900 00:00:00'), 'right format';
-is $date->epoch, undef, 'no epoch value';
+subtest "RFC 822/1123" => sub {
+ my $date = Mojo::Date->new('Sun, 06 Nov 1994 08:49:37 GMT');
+ is $date->epoch, 784111777, 'right epoch value';
+ $date = Mojo::Date->new('Fri, 13 May 2011 10:00:24 GMT');
+ is $date->epoch, 1305280824, 'right epoch value';
+};
+
+subtest "RFC 850/1036" => sub {
+ is(Mojo::Date->new('Sunday, 06-Nov-94 08:49:37 GMT')->epoch, 784111777,
'right epoch value');
+ is(Mojo::Date->new('Friday, 13-May-11 10:00:24 GMT')->epoch, 1305280824,
'right epoch value');
+};
+
+subtest "RFC 3339" => sub {
+ is(Mojo::Date->new('2014-08-20T20:45:00')->epoch, 1408567500,
'right epoch value');
+ is(Mojo::Date->new(1408567500)->to_datetime,
'2014-08-20T20:45:00Z', 'right format');
+ is(Mojo::Date->new('2014-08-20T20:45:00.01')->epoch, 1408567500.01,
'right epoch value');
+ is(Mojo::Date->new('2014-08-20T20:45:00-00:46')->epoch, 1408570260,
'right epoch value');
+ is(Mojo::Date->new(1408570260)->to_datetime,
'2014-08-20T21:31:00Z', 'right format');
+ is(Mojo::Date->new('2014-08-20t20:45:00-01:46')->epoch, 1408573860,
'right epoch value');
+ is(Mojo::Date->new('2014-08-20t20:45:00+01:46')->epoch, 1408561140,
'right epoch value');
+ is(Mojo::Date->new(1408561140)->to_datetime,
'2014-08-20T18:59:00Z', 'right format');
+ is(Mojo::Date->new('1994-11-06T08:49:37Z')->epoch, 784111777,
'right epoch value');
+ is(Mojo::Date->new('1994-11-06t08:49:37.33z')->epoch, 784111777.33,
'right epoch value');
+ is(Mojo::Date->new(784111777.33)->to_datetime,
'1994-11-06T08:49:37.33Z', 'right format');
+};
+
+subtest "Special cases" => sub {
+ is(Mojo::Date->new('Sun , 06-Nov-1994 08:49:37 UTC')->epoch, 784111777,
'right epoch value');
+ is(Mojo::Date->new('Sunday,06 Nov 94 08:49:37 UTC')->epoch, 784111777,
'right epoch value');
+ is(Mojo::Date->new('Sunday 06 Nov 94 08:49:37UTC')->epoch, 784111777,
'right epoch value');
+ is(Mojo::Date->new('2014-08-20 20:45:00')->epoch, 1408567500,
'right epoch value');
+};
+
+subtest "ANSI C asctime()" => sub {
+ is(Mojo::Date->new('Sun Nov 6 08:49:37 1994')->epoch, 784111777, 'right
epoch value');
+ is(Mojo::Date->new('Fri May 13 10:00:24 2011')->epoch, 1305280824, 'right
epoch value');
+};
+
+subtest "Invalid string" => sub {
+ is(Mojo::Date->new('')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('123 abc')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('abc')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('Xxx, 00 Xxx 0000 00:00:00 XXX')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('Sun, 06 Nov 1994 08:49:37 GMT GARBAGE')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('Sunday, 06-Nov-94 08:49:37 GMT GARBAGE')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('Sun Nov 6 08:49:37 1994 GARBAGE')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('Fri, 75 May 2011 99:99:99 GMT')->epoch, undef,
'no epoch value');
+ is(Mojo::Date->new('0000-00-00T00:00:00+01:00')->epoch, undef,
'no epoch value');
+};
+
+subtest "to_string" => sub {
+ my $date = Mojo::Date->new(784111777);
+ is "$date", 'Sun, 06 Nov 1994 08:49:37 GMT', 'right format';
+ $date = Mojo::Date->new(1305280824);
+ is $date->to_string, 'Fri, 13 May 2011 10:00:24 GMT', 'right format';
+ $date = Mojo::Date->new('1305280824.23');
+ is $date->to_string, 'Fri, 13 May 2011 10:00:24 GMT', 'right format';
+};
+
+subtest "Current time roundtrips" => sub {
+ my $before = time;
+ ok(Mojo::Date->new(Mojo::Date->new->to_string)->epoch >= $before,
'successful roundtrip');
+ ok(Mojo::Date->new(Mojo::Date->new->to_datetime)->epoch >= $before,
'successful roundtrip');
+};
+
+subtest "Zero time checks" => sub {
+ my $date = Mojo::Date->new(0);
+ is $date->epoch, 0, 'right epoch value';
+ is "$date", 'Thu, 01 Jan 1970 00:00:00 GMT', 'right format';
+ is(Mojo::Date->new('Thu, 01 Jan 1970 00:00:00 GMT')->epoch, 0, 'right epoch
value');
+};
+
+subtest "No epoch value" => sub {
+ my $date = Mojo::Date->new;
+ ok $date->parse('Mon, 01 Jan 1900 00:00:00'), 'right format';
+ is $date->epoch, undef, 'no epoch value';
+};
done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Mojolicious-8.51/t/mojo/request.t
new/Mojolicious-8.52/t/mojo/request.t
--- old/Mojolicious-8.51/t/mojo/request.t 2020-05-30 23:40:49.000000000
+0200
+++ new/Mojolicious-8.52/t/mojo/request.t 2020-06-01 14:14:35.000000000
+0200
@@ -318,7 +318,8 @@
ok !$upgrade, 'upgrade event has not been emitted';
$req->parse("o World!\n");
ok $upgrade, 'upgrade event has been emitted';
- is $size, 13, 'file has content';
+ is $size, 0, 'file had no content yet';
+ is $req->content->asset->size, 13, 'file has content';
is $req->content->progress, 13, 'right progress';
ok $req->content->asset->is_file, 'stored in file';
$req->parse("1234\nlalalala\n");