Skip to content

Commit

Permalink
Use the latest version of perltidy
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 11, 2024
1 parent aa96f58 commit e131bb1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
40 changes: 20 additions & 20 deletions t/mojo/asset.t
Expand Up @@ -13,10 +13,10 @@ subtest 'File asset' => sub {
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('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->size, 3, 'right size';
is $file->mtime, (stat $file->handle)[9], 'right mtime';
is $file->to_file, $file, 'same object';

Expand All @@ -29,10 +29,10 @@ subtest 'File asset' => sub {
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('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->size, 3, 'right size';
is $mem->mtime, $^T, 'right mtime';
is $mem->mtime, Mojo::Asset::Memory->new->mtime, 'same mtime';
my $mtime = $mem->mtime;
Expand Down Expand Up @@ -72,30 +72,30 @@ 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('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('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('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';
Expand All @@ -110,10 +110,10 @@ 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('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';
Expand Down
18 changes: 9 additions & 9 deletions t/mojo/util.t
Expand Up @@ -637,23 +637,23 @@ subtest 'scope_guard' => sub {
};

subtest 'humanize_bytes' => sub {
is humanize_bytes(0), '0B', 'zero Bytes';
is humanize_bytes(1), '1B', 'one Byte';
is humanize_bytes( 0), '0B', 'zero Bytes';
is humanize_bytes( 1), '1B', 'one Byte';
is humanize_bytes(-1023), '-1023B', 'negative Bytes';
is humanize_bytes(1024), '1KiB', 'one KiB';
is humanize_bytes(1025), '1KiB', 'one KiB';
is humanize_bytes( 1024), '1KiB', 'one KiB';
is humanize_bytes( 1025), '1KiB', 'one KiB';
is humanize_bytes(1024 * 1024), '1MiB', 'one MiB';
is humanize_bytes(1024 * 1024 * 1024), '1GiB', 'one GiB';
is humanize_bytes(1024 * 1024 * 1024 * 1024), '1TiB', 'one TiB';
is humanize_bytes(3000), '2.9KiB', 'almost 3KiB';
is humanize_bytes( 3000), '2.9KiB', 'almost 3KiB';
is humanize_bytes(-3000), '-2.9KiB', 'almost -3KiB';
is humanize_bytes(13443399680), '13GiB', 'two digits GiB';
is humanize_bytes(8007188480), '7.5GiB', 'smaller GiB';
is humanize_bytes( 13443399680), '13GiB', 'two digits GiB';
is humanize_bytes( 8007188480), '7.5GiB', 'smaller GiB';
is humanize_bytes(-8007188480), '-7.5GiB', 'negative smaller GiB';
is humanize_bytes(-1099511627776), '-1TiB', 'negative smaller TiB';
is humanize_bytes(717946880), '685MiB', 'large MiB';
is humanize_bytes( 717946880), '685MiB', 'large MiB';
is humanize_bytes(-717946880), '-685MiB', 'large negative MiB';
is humanize_bytes(245760), '240KiB', 'less than a MiB';
is humanize_bytes( 245760), '240KiB', 'less than a MiB';
};

subtest 'Hide DATA usage from error messages' => sub {
Expand Down

0 comments on commit e131bb1

Please sign in to comment.