Skip to content

Commit 4e8cff6

Browse files
authored
Merge pull request #1878 from mojolicious/tidy
use the new perltidy
2 parents dbcd24b + 7d13a5b commit 4e8cff6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3279
-3279
lines changed

t/mojo/asset.t

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ use Mojo::File qw(path tempdir);
99

1010
subtest 'File asset' => sub {
1111
my $file = Mojo::Asset::File->new;
12-
is $file->size, 0, 'file is empty';
12+
is $file->size, 0, 'file is empty';
1313
is $file->mtime, (stat $file->handle)[9], 'right mtime';
14-
is $file->slurp, '', 'file is empty';
14+
is $file->slurp, '', 'file is empty';
1515
$file->add_chunk('abc');
1616
is $file->contains('abc'), 0, '"abc" at position 0';
1717
is $file->contains('bc'), 1, '"bc" at position 1';
1818
is $file->contains('db'), -1, 'does not contain "db"';
19-
is $file->size, 3, 'right size';
19+
is $file->size, 3, 'right size';
2020
is $file->mtime, (stat $file->handle)[9], 'right mtime';
21-
is $file->to_file, $file, 'same object';
21+
is $file->to_file, $file, 'same object';
2222

2323
my $path = $file->path;
2424
ok -e $path, 'temporary file exists';
@@ -29,12 +29,12 @@ subtest 'File asset' => sub {
2929
subtest 'Memory asset' => sub {
3030
my $mem = Mojo::Asset::Memory->new;
3131
$mem->add_chunk('abc');
32-
is $mem->contains('abc'), 0, '"abc" at position 0';
33-
is $mem->contains('bc'), 1, '"bc" at position 1';
34-
is $mem->contains('db'), -1, 'does not contain "db"';
35-
is $mem->size, 3, 'right size';
36-
is $mem->mtime, $^T, 'right mtime';
37-
is $mem->mtime, Mojo::Asset::Memory->new->mtime, 'same mtime';
32+
is $mem->contains('abc'), 0, '"abc" at position 0';
33+
is $mem->contains('bc'), 1, '"bc" at position 1';
34+
is $mem->contains('db'), -1, 'does not contain "db"';
35+
is $mem->size, 3, 'right size';
36+
is $mem->mtime, $^T, 'right mtime';
37+
is $mem->mtime, Mojo::Asset::Memory->new->mtime, 'same mtime';
3838
my $mtime = $mem->mtime;
3939
is $mem->mtime($mtime + 23)->mtime, $mtime + 23, 'right mtime';
4040
};
@@ -53,17 +53,17 @@ subtest 'Asset upgrade from memory to file' => sub {
5353

5454
subtest 'Empty file asset' => sub {
5555
my $file = Mojo::Asset::File->new;
56-
is $file->size, 0, 'asset is empty';
57-
is $file->get_chunk(0), '', 'no content';
58-
is $file->slurp, '', 'no content';
56+
is $file->size, 0, 'asset is empty';
57+
is $file->get_chunk(0), '', 'no content';
58+
is $file->slurp, '', 'no content';
5959
is $file->contains('a'), -1, 'does not contain "a"';
6060
};
6161

6262
subtest 'Empty memory asset' => sub {
6363
my $mem = Mojo::Asset::Memory->new;
64-
is $mem->size, 0, 'asset is empty';
64+
is $mem->size, 0, 'asset is empty';
6565
is $mem->get_chunk(0), '', 'no content';
66-
is $mem->slurp, '', 'no content';
66+
is $mem->slurp, '', 'no content';
6767
ok !$mem->is_range, 'no range';
6868
is $mem->contains('a'), -1, 'does not contain "a"';
6969
};
@@ -100,10 +100,10 @@ subtest 'File asset range support (ab[cdefghi]jk)' => sub {
100100
is $file->get_chunk(0), 'cdefghi', 'chunk from position 0';
101101
is $file->get_chunk(1), 'defghi', 'chunk from position 1';
102102
is $file->get_chunk(5), 'hi', 'chunk from position 5';
103-
is $file->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
104-
is $file->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
105-
is $file->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
106-
is $file->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
103+
is $file->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
104+
is $file->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
105+
is $file->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
106+
is $file->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
107107
};
108108

109109
subtest 'Memory asset range support (ab[cdefghi]jk)' => sub {
@@ -119,10 +119,10 @@ subtest 'Memory asset range support (ab[cdefghi]jk)' => sub {
119119
is $mem->get_chunk(0), 'cdefghi', 'chunk from position 0';
120120
is $mem->get_chunk(1), 'defghi', 'chunk from position 1';
121121
is $mem->get_chunk(5), 'hi', 'chunk from position 5';
122-
is $mem->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
123-
is $mem->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
124-
is $mem->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
125-
is $mem->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
122+
is $mem->get_chunk(0, 2), 'cd', 'chunk from position 0 (2 bytes)';
123+
is $mem->get_chunk(1, 3), 'def', 'chunk from position 1 (3 bytes)';
124+
is $mem->get_chunk(5, 1), 'h', 'chunk from position 5 (1 byte)';
125+
is $mem->get_chunk(5, 3), 'hi', 'chunk from position 5 (2 byte)';
126126
};
127127

128128
subtest 'Huge file asset' => sub {
@@ -132,16 +132,16 @@ subtest 'Huge file asset' => sub {
132132
$file->add_chunk('b');
133133
$file->add_chunk('c' x 131072);
134134
$file->add_chunk('ddd');
135-
is $file->contains('a'), 0, '"a" at position 0';
136-
is $file->contains('b'), 131072, '"b" at position 131072';
137-
is $file->contains('c'), 131073, '"c" at position 131073';
138-
is $file->contains('abc'), 131071, '"abc" at position 131071';
139-
is $file->contains('ccdd'), 262143, '"ccdd" at position 262143';
140-
is $file->contains('dd'), 262145, '"dd" at position 262145';
141-
is $file->contains('ddd'), 262145, '"ddd" at position 262145';
142-
is $file->contains('e'), -1, 'does not contain "e"';
143-
is $file->contains('a' x 131072), 0, '"a" x 131072 at position 0';
144-
is $file->contains('c' x 131072), 131073, '"c" x 131072 at position 131073';
135+
is $file->contains('a'), 0, '"a" at position 0';
136+
is $file->contains('b'), 131072, '"b" at position 131072';
137+
is $file->contains('c'), 131073, '"c" at position 131073';
138+
is $file->contains('abc'), 131071, '"abc" at position 131071';
139+
is $file->contains('ccdd'), 262143, '"ccdd" at position 262143';
140+
is $file->contains('dd'), 262145, '"dd" at position 262145';
141+
is $file->contains('ddd'), 262145, '"ddd" at position 262145';
142+
is $file->contains('e'), -1, 'does not contain "e"';
143+
is $file->contains('a' x 131072), 0, '"a" x 131072 at position 0';
144+
is $file->contains('c' x 131072), 131073, '"c" x 131072 at position 131073';
145145
is $file->contains('b' . ('c' x 131072) . "ddd"), 131072, '"b" . ("c" x 131072) . "ddd" at position 131072';
146146
};
147147

@@ -151,14 +151,14 @@ subtest 'Huge file asset with range' => sub {
151151
$file->add_chunk('b');
152152
$file->add_chunk('c' x 131072);
153153
$file->add_chunk('ddd');
154-
is $file->contains('a'), 0, '"a" at position 0';
155-
is $file->contains('b'), 131071, '"b" at position 131071';
156-
is $file->contains('c'), 131072, '"c" at position 131072';
157-
is $file->contains('abc'), 131070, '"abc" at position 131070';
158-
is $file->contains('ccdd'), 262142, '"ccdd" at position 262142';
159-
is $file->contains('dd'), 262144, '"dd" at position 262144';
160-
is $file->contains('ddd'), -1, 'does not contain "ddd"';
161-
is $file->contains('b' . ('c' x 131072) . 'ddd'), -1, 'does not contain "b" . ("c" x 131072) . "ddd"';
154+
is $file->contains('a'), 0, '"a" at position 0';
155+
is $file->contains('b'), 131071, '"b" at position 131071';
156+
is $file->contains('c'), 131072, '"c" at position 131072';
157+
is $file->contains('abc'), 131070, '"abc" at position 131070';
158+
is $file->contains('ccdd'), 262142, '"ccdd" at position 262142';
159+
is $file->contains('dd'), 262144, '"dd" at position 262144';
160+
is $file->contains('ddd'), -1, 'does not contain "ddd"';
161+
is $file->contains('b' . ('c' x 131072) . 'ddd'), -1, 'does not contain "b" . ("c" x 131072) . "ddd"';
162162
};
163163

164164
subtest 'Move memory asset to file' => sub {
@@ -169,13 +169,13 @@ subtest 'Move memory asset to file' => sub {
169169
undef $tmp;
170170
ok !-e $path, 'file has been cleaned up';
171171
is $mem->move_to($path)->slurp, 'abc', 'right content';
172-
ok -e $path, 'file exists';
172+
ok -e $path, 'file exists';
173173
ok unlink($path), 'unlinked file';
174-
ok !-e $path, 'file has been cleaned up';
174+
ok !-e $path, 'file has been cleaned up';
175175
is(Mojo::Asset::Memory->new->move_to($path)->slurp, '', 'no content');
176-
ok -e $path, 'file exists';
176+
ok -e $path, 'file exists';
177177
ok unlink($path), 'unlinked file';
178-
ok !-e $path, 'file has been cleaned up';
178+
ok !-e $path, 'file has been cleaned up';
179179
};
180180

181181
subtest 'Move file asset to file' => sub {
@@ -190,29 +190,29 @@ subtest 'Move file asset to file' => sub {
190190
ok !-e $path, 'file has been cleaned up';
191191
is $file->move_to($path)->slurp, 'bcd', 'right content';
192192
undef $file;
193-
ok -e $path, 'file exists';
193+
ok -e $path, 'file exists';
194194
ok unlink($path), 'unlinked file';
195-
ok !-e $path, 'file has been cleaned up';
195+
ok !-e $path, 'file has been cleaned up';
196196
is(Mojo::Asset::File->new->move_to($path)->slurp, '', 'no content');
197-
ok -e $path, 'file exists';
197+
ok -e $path, 'file exists';
198198
ok unlink($path), 'unlinked file';
199-
ok !-e $path, 'file has been cleaned up';
199+
ok !-e $path, 'file has been cleaned up';
200200
};
201201

202202
subtest 'Upgrade' => sub {
203203
my $asset = Mojo::Asset::Memory->new(max_memory_size => 5, auto_upgrade => 1);
204204
my $upgrade;
205205
$asset->on(upgrade => sub { $upgrade++ });
206206
$asset = $asset->add_chunk('lala');
207-
ok !$upgrade, 'upgrade event has not been emitted';
207+
ok !$upgrade, 'upgrade event has not been emitted';
208208
ok !$asset->is_file, 'stored in memory';
209209
$asset = $asset->add_chunk('lala');
210210
is $upgrade, 1, 'upgrade event has been emitted once';
211211
ok $asset->is_file, 'stored in file';
212212
$asset = $asset->add_chunk('lala');
213213
is $upgrade, 1, 'upgrade event was not emitted again';
214214
ok $asset->is_file, 'stored in file';
215-
is $asset->slurp, 'lalalalalala', 'right content';
215+
is $asset->slurp, 'lalalalalala', 'right content';
216216
ok $asset->cleanup, 'file will be cleaned up';
217217
$asset = Mojo::Asset::Memory->new(max_memory_size => 5);
218218
$asset = $asset->add_chunk('lala');
@@ -232,17 +232,17 @@ subtest 'Change temporary directory during upgrade' => sub {
232232
);
233233
my $file = $mem->add_chunk('aaaaaaaaaaa');
234234
ok $file->is_file, 'stored in file';
235-
is $file->slurp, 'aaaaaaaaaaa', 'right content';
236-
is path($file->path)->dirname, $tmpdir, 'right directory';
235+
is $file->slurp, 'aaaaaaaaaaa', 'right content';
236+
is path($file->path)->dirname, $tmpdir, 'right directory';
237237
};
238238

239239
subtest 'Temporary directory' => sub {
240240
local $ENV{MOJO_TMPDIR} = my $tmpdir = tempdir;
241241
my $file = Mojo::Asset::File->new;
242242
is($file->tmpdir, $tmpdir, 'same directory');
243243
$file->add_chunk('works!');
244-
is $file->slurp, 'works!', 'right content';
245-
is path($file->path)->dirname, $tmpdir, 'same directory';
244+
is $file->slurp, 'works!', 'right content';
245+
is path($file->path)->dirname, $tmpdir, 'same directory';
246246
};
247247

248248
subtest 'Custom temporary file' => sub {
@@ -262,15 +262,15 @@ subtest 'Custom temporary file' => sub {
262262
subtest 'Temporary file without cleanup' => sub {
263263
my $file = Mojo::Asset::File->new(cleanup => 0)->add_chunk('test');
264264
ok $file->is_file, 'stored in file';
265-
is $file->slurp, 'test', 'right content';
266-
is $file->size, 4, 'right size';
265+
is $file->slurp, 'test', 'right content';
266+
is $file->size, 4, 'right size';
267267
is $file->mtime, (stat $file->handle)[9], 'right mtime';
268-
is $file->contains('es'), 1, '"es" at position 1';
268+
is $file->contains('es'), 1, '"es" at position 1';
269269
my $path = $file->path;
270270
undef $file;
271-
ok -e $path, 'file exists';
271+
ok -e $path, 'file exists';
272272
ok unlink($path), 'unlinked file';
273-
ok !-e $path, 'file has been cleaned up';
273+
ok !-e $path, 'file has been cleaned up';
274274
};
275275

276276
subtest 'Incomplete write' => sub {

t/mojo/base.t

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ subtest 'Instance method' => sub {
7474
subtest 'Default value defined but false' => sub {
7575
my $object = Mojo::BaseTestTestTest->new;
7676
ok defined($object->yada);
77-
is $object->yada, 0, 'right attribute value';
77+
is $object->yada, 0, 'right attribute value';
7878
is $object->yada(5)->yada, 5, 'right attribute value';
7979
};
8080

@@ -88,27 +88,27 @@ subtest 'Default value support' => sub {
8888

8989
subtest 'Chained attributes and callback default value support' => sub {
9090
my $object = Mojo::BaseTest->new;
91-
is $object->bar, 2, 'right attribute value';
91+
is $object->bar, 2, 'right attribute value';
9292
is $object->bar(6)->bar, 6, 'right chained attribute value';
93-
is $object->baz, 2, 'right attribute value';
93+
is $object->baz, 2, 'right attribute value';
9494
is $object->baz(6)->baz, 6, 'right chained attribute value';
9595
};
9696

9797
subtest 'Tap into chain' => sub {
9898
my $object = Mojo::BaseTest->new;
99-
is $object->tap(sub { $_->name('foo') })->name, 'foo', 'right attribute value';
99+
is $object->tap(sub { $_->name('foo') })->name, 'foo', 'right attribute value';
100100
is $object->tap(sub { shift->name('bar')->name })->name, 'bar', 'right attribute value';
101-
is $object->tap('tests')->tests, 1, 'right attribute value';
102-
is $object->more_tests, 2, 'right attribute value';
103-
is $object->tap('more_tests')->tests, 3, 'right attribute value';
104-
is $object->tap(more_tests => 3)->tests, 6, 'right attribute value';
101+
is $object->tap('tests')->tests, 1, 'right attribute value';
102+
is $object->more_tests, 2, 'right attribute value';
103+
is $object->tap('more_tests')->tests, 3, 'right attribute value';
104+
is $object->tap(more_tests => 3)->tests, 6, 'right attribute value';
105105
};
106106

107107
subtest 'Inherit -base flag' => sub {
108108
my $object = Mojo::BaseTest::Base3->new(test => 1);
109-
is $object->test, 1, 'right attribute value';
110-
is $object->foo, undef, 'no attribute value';
111-
is $object->foo(3)->foo, 3, 'right attribute value';
109+
is $object->test, 1, 'right attribute value';
110+
is $object->foo, undef, 'no attribute value';
111+
is $object->foo(3)->foo, 3, 'right attribute value';
112112
};
113113

114114
subtest 'Exceptions' => sub {
@@ -138,7 +138,7 @@ subtest 'Weaken' => sub {
138138
ok isweak($weak->six($weak)->{six}), 'weakened value';
139139
is $weak->six, $weak, 'circular reference';
140140
$weak = Mojo::BaseTest::Weak3->new(one => 23);
141-
is $weak->one, 23, 'right value';
141+
is $weak->one, 23, 'right value';
142142
is $weak->one(24)->one, 24, 'right value';
143143
is $weak->four(25)->four, 25, 'right value';
144144
};

t/mojo/bytestream.t

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ subtest 'Nested bytestreams' => sub {
111111

112112
subtest 'split' => sub {
113113
my $stream = b('1,2,3,4,5');
114-
is_deeply $stream->split(',')->to_array, [1, 2, 3, 4, 5], 'right elements';
115-
is_deeply $stream->split(qr/,/)->to_array, [1, 2, 3, 4, 5], 'right elements';
116-
is_deeply b('1,2,3,4,5,,,')->split(',')->to_array, [1, 2, 3, 4, 5], 'right elements';
114+
is_deeply $stream->split(',')->to_array, [1, 2, 3, 4, 5], 'right elements';
115+
is_deeply $stream->split(qr/,/)->to_array, [1, 2, 3, 4, 5], 'right elements';
116+
is_deeply b('1,2,3,4,5,,,')->split(',')->to_array, [1, 2, 3, 4, 5], 'right elements';
117117
is_deeply b('1,2,3,4,5,,,')->split(',', -1)->to_array, [1, 2, 3, 4, 5, '', '', ''], 'right elements';
118-
is_deeply b('54321')->split('')->to_array, [5, 4, 3, 2, 1], 'right elements';
119-
is_deeply b('')->split('')->to_array, [], 'no elements';
120-
is_deeply b('')->split(',')->to_array, [], 'no elements';
121-
is_deeply b('')->split(qr/,/)->to_array, [], 'no elements';
118+
is_deeply b('54321')->split('')->to_array, [5, 4, 3, 2, 1], 'right elements';
119+
is_deeply b('')->split('')->to_array, [], 'no elements';
120+
is_deeply b('')->split(',')->to_array, [], 'no elements';
121+
is_deeply b('')->split(qr/,/)->to_array, [], 'no elements';
122122
$stream = b('1/2/3');
123-
is $stream->split('/')->map(sub { $_->quote })->join(', '), '"1", "2", "3"', 'right result';
123+
is $stream->split('/')->map(sub { $_->quote })->join(', '), '"1", "2", "3"', 'right result';
124124
is $stream->split('/')->map(sub { shift->quote })->join(', '), '"1", "2", "3"', 'right result';
125125
};
126126

@@ -138,7 +138,7 @@ subtest 'clone' => sub {
138138
my $stream = b('foo');
139139
my $clone = $stream->clone;
140140
isnt $stream->b64_encode->to_string, 'foo', 'original changed';
141-
is $clone->to_string, 'foo', 'clone did not change';
141+
is $clone->to_string, 'foo', 'clone did not change';
142142
};
143143

144144
subtest 'say and autojoin' => sub {

t/mojo/cache.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ subtest 'Basics' => sub {
2727

2828
subtest 'Bigger cache' => sub {
2929
my $cache = Mojo::Cache->new(max_keys => 3);
30-
is $cache->get('foo'), undef, 'no result';
30+
is $cache->get('foo'), undef, 'no result';
3131
is $cache->set(foo => 'bar')->get('foo'), 'bar', 'right result';
3232
$cache->set(bar => 'baz');
3333
is $cache->get('foo'), 'bar', 'right result';
@@ -45,7 +45,7 @@ subtest 'Bigger cache' => sub {
4545

4646
subtest 'Cache disabled' => sub {
4747
my $cache = Mojo::Cache->new(max_keys => 0);
48-
is $cache->get('foo'), undef, 'no result';
48+
is $cache->get('foo'), undef, 'no result';
4949
is $cache->set(foo => 'bar')->get('foo'), undef, 'no result';
5050

5151
$cache = Mojo::Cache->new(max_keys => -1);

0 commit comments

Comments
 (0)