Skip to content

Commit a9e7e6b

Browse files
committed
Use the latest perltidy
1 parent 2376b90 commit a9e7e6b

28 files changed

+1696
-655
lines changed

examples/login/t/login.t

+11-4
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@ my $t = Test::Mojo->new('LoginApp');
77
$t->ua->max_redirects(1);
88

99
subtest 'Test login workflow' => sub {
10-
$t->get_ok('/')->status_is(200)->element_exists('form input[name="user"]')->element_exists('form input[name="pass"]')
10+
$t->get_ok('/')
11+
->status_is(200)
12+
->element_exists('form input[name="user"]')
13+
->element_exists('form input[name="pass"]')
1114
->element_exists('form input[type="submit"]');
1215

13-
$t->post_ok('/' => form => {user => 'sebastian', pass => 'secr3t'})->status_is(200)
16+
$t->post_ok('/' => form => {user => 'sebastian', pass => 'secr3t'})
17+
->status_is(200)
1418
->text_like('html body' => qr/Welcome sebastian/);
1519

1620
$t->get_ok('/protected')->status_is(200)->text_like('a' => qr/Logout/);
1721

18-
$t->get_ok('/logout')->status_is(200)->element_exists('form input[name="user"]')
19-
->element_exists('form input[name="pass"]')->element_exists('form input[type="submit"]');
22+
$t->get_ok('/logout')
23+
->status_is(200)
24+
->element_exists('form input[name="user"]')
25+
->element_exists('form input[name="pass"]')
26+
->element_exists('form input[type="submit"]');
2027
};
2128

2229
done_testing();

lib/Mojolicious/Command/version.pm

+4-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ EOF
4141

4242
# Check latest version on CPAN
4343
my $latest = eval {
44-
$self->app->ua->max_redirects(10)->tap(sub { $_->proxy->detect })
45-
->get('fastapi.metacpan.org/v1/release/Mojolicious')->result->json->{version};
44+
$self->app->ua->max_redirects(10)
45+
->tap(sub { $_->proxy->detect })
46+
->get('fastapi.metacpan.org/v1/release/Mojolicious')
47+
->result->json->{version};
4648
} or return;
4749

4850
my $msg = 'This version is up to date, have fun!';

t/mojo/promise.t

+7-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ subtest 'Resolved chained' => sub {
116116
subtest 'Rejected chained' => sub {
117117
my $promise = Mojo::Promise->new;
118118
my @errors;
119-
$promise->then(undef, sub {"$_[0]:1"})->then(sub {"$_[0]:2"}, sub {"$_[0]:fail"})->then(sub {"$_[0]:3"})
119+
$promise->then(undef, sub {"$_[0]:1"})
120+
->then(sub {"$_[0]:2"}, sub {"$_[0]:fail"})
121+
->then(sub {"$_[0]:3"})
120122
->then(sub { push @errors, "$_[0]:4" });
121123
$promise->reject('tset');
122124
Mojo::IOLoop->one_tick;
@@ -226,7 +228,10 @@ subtest 'Clone' => sub {
226228
subtest 'Exception in chain' => sub {
227229
my $promise = Mojo::Promise->new;
228230
my (@results, @errors);
229-
$promise->then(sub {@_})->then(sub {@_})->then(sub { die "test: $_[0]\n" })->then(sub { push @results, 'fail' })
231+
$promise->then(sub {@_})
232+
->then(sub {@_})
233+
->then(sub { die "test: $_[0]\n" })
234+
->then(sub { push @results, 'fail' })
230235
->catch(sub { @errors = @_ });
231236
$promise->resolve('works');
232237
Mojo::IOLoop->one_tick;

t/mojo/websocket.t

+4-2
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,10 @@ subtest 'Promises' => sub {
356356
$ua->websocket_p('/foo')->then(sub { $result = 'test failed' })->catch(sub { $result = shift })->wait;
357357
is $result, 'WebSocket handshake failed', 'right result';
358358
$result = undef;
359-
$ua->websocket_p($ua->server->url->to_abs->scheme('wsss'))->then(sub { $result = 'test failed' })
360-
->catch(sub { $result = shift })->wait;
359+
$ua->websocket_p($ua->server->url->to_abs->scheme('wsss'))
360+
->then(sub { $result = 'test failed' })
361+
->catch(sub { $result = shift })
362+
->wait;
361363
is $result, 'Unsupported protocol: wsss', 'right result';
362364
};
363365

t/mojolicious/app.t

+272-105
Large diffs are not rendered by default.

t/mojolicious/charset_lite_app.t

+14-5
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,29 @@ my $t = Test::Mojo->new;
5959
$t->post_ok('/' => form => {foo => 'yatta'})->status_is(200)->content_is('foo: yatta');
6060

6161
# Send raw Shift_JIS octets (like browsers do)
62-
$t->post_ok('/' => form => {foo => $yatta_sjis} => charset => undef)->status_is(200)
63-
->content_type_unlike(qr/application/)->content_type_like(qr/Shift_JIS/)->content_like(qr/$yatta/);
62+
$t->post_ok('/' => form => {foo => $yatta_sjis} => charset => undef)
63+
->status_is(200)
64+
->content_type_unlike(qr/application/)
65+
->content_type_like(qr/Shift_JIS/)
66+
->content_like(qr/$yatta/);
6467

6568
# Send raw Shift_JIS octets (like browsers do, multipart message)
6669
$t->post_ok('/' => {'Content-Type' => 'multipart/form-data'} => form => {foo => $yatta_sjis} => charset => undef)
67-
->status_is(200)->content_type_like(qr/Shift_JIS/)->content_like(qr/$yatta/);
70+
->status_is(200)
71+
->content_type_like(qr/Shift_JIS/)
72+
->content_like(qr/$yatta/);
6873

6974
# Send as string
70-
$t->post_ok('/' => form => {foo => $yatta} => charset => 'shift_jis')->status_is(200)->content_type_like(qr/Shift_JIS/)
75+
$t->post_ok('/' => form => {foo => $yatta} => charset => 'shift_jis')
76+
->status_is(200)
77+
->content_type_like(qr/Shift_JIS/)
7178
->content_like(qr/$yatta/);
7279

7380
# Send as string (multipart message)
7481
$t->post_ok('/' => {'Content-Type' => 'multipart/form-data'} => form => {foo => $yatta} => charset => 'shift_jis')
75-
->status_is(200)->content_type_like(qr/Shift_JIS/)->content_like(qr/$yatta/);
82+
->status_is(200)
83+
->content_type_like(qr/Shift_JIS/)
84+
->content_like(qr/$yatta/);
7685

7786
# Unicode renderer
7887
$t->get_ok('/unicode')->status_is(200)->content_type_is('text/plain;charset=UTF-8')->content_is($yatta);

t/mojolicious/dispatcher_lite_app.t

+15-5
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ subtest 'Normal route' => sub {
127127
};
128128

129129
subtest 'Normal static file' => sub {
130-
$t->get_ok('/test.txt')->status_is(200)->header_is('Cache-Control' => 'max-age=3600, must-revalidate')
130+
$t->get_ok('/test.txt')
131+
->status_is(200)
132+
->header_is('Cache-Control' => 'max-age=3600, must-revalidate')
131133
->content_is("Normal static file!\n");
132134
};
133135

@@ -144,22 +146,30 @@ subtest 'Custom dispatcher' => sub {
144146
};
145147

146148
subtest 'Static file' => sub {
147-
$t->get_ok('/res.txt')->status_is(200)->header_is('Cache-Control' => 'max-age=3600, must-revalidate')
149+
$t->get_ok('/res.txt')
150+
->status_is(200)
151+
->header_is('Cache-Control' => 'max-age=3600, must-revalidate')
148152
->content_is("Static response!\n");
149153
};
150154

151155
subtest ' Custom response' => sub {
152-
$t->get_ok('/res.txt?route=1')->status_is(202)->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
156+
$t->get_ok('/res.txt?route=1')
157+
->status_is(202)
158+
->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
153159
->content_is('Custom response!');
154160
};
155161

156162
subtest 'Conditional response' => sub {
157-
$t->get_ok('/res.txt?route=1&res=1')->status_is(201)->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
163+
$t->get_ok('/res.txt?route=1&res=1')
164+
->status_is(201)
165+
->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
158166
->content_is('Conditional response!');
159167
};
160168

161169
subtest 'Another custom dispatcher' => sub {
162-
$t->get_ok('/custom_too')->status_is(200)->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
170+
$t->get_ok('/custom_too')
171+
->status_is(200)
172+
->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
163173
->content_is('this works too');
164174
};
165175

t/mojolicious/embedded_lite_app.t

+27-10
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ subtest 'Stream from myapp.pl with Unicode prefix' => sub {
260260
};
261261

262262
subtest 'URL from myapp.pl with Unicode prefix' => sub {
263-
$t->get_ok('/x/♥/url/☃')->status_is(200)
263+
$t->get_ok('/x/♥/url/☃')
264+
->status_is(200)
264265
->content_is('/x/%E2%99%A5/url/%E2%98%83.json -> /x/%E2%99%A5/%E2%98%83/stream!');
265266
};
266267

@@ -326,7 +327,9 @@ EOF
326327
};
327328

328329
subtest 'Host from myapp.pl with domain' => sub {
329-
$t->get_ok('/host' => {Host => 'mojolicious.org'})->status_is(200)->header_is('X-Message' => 'it works!')
330+
$t->get_ok('/host' => {Host => 'mojolicious.org'})
331+
->status_is(200)
332+
->header_is('X-Message' => 'it works!')
330333
->content_is('mojolicious.org');
331334
};
332335

@@ -344,7 +347,9 @@ EOF
344347
};
345348

346349
subtest 'Host from myapp.pl with domain again' => sub {
347-
$t->get_ok('/host' => {Host => 'mojolicious.org'})->status_is(200)->header_is('X-Message' => 'it works!')
350+
$t->get_ok('/host' => {Host => 'mojolicious.org'})
351+
->status_is(200)
352+
->header_is('X-Message' => 'it works!')
348353
->content_is('mojolicious.org');
349354
};
350355

@@ -362,17 +367,23 @@ EOF
362367
};
363368

364369
subtest 'Host from myapp.pl with wildcard domain' => sub {
365-
$t->get_ok('/host' => {Host => 'ExAmPlE.CoM'})->status_is(200)->header_is('X-Message' => 'it works!')
370+
$t->get_ok('/host' => {Host => 'ExAmPlE.CoM'})
371+
->status_is(200)
372+
->header_is('X-Message' => 'it works!')
366373
->content_is('ExAmPlE.CoM');
367374
};
368375

369376
subtest 'Host from myapp.pl with wildcard domain again' => sub {
370-
$t->get_ok('/host' => {Host => 'www.example.com'})->status_is(200)->header_is('X-Message' => 'it works!')
377+
$t->get_ok('/host' => {Host => 'www.example.com'})
378+
->status_is(200)
379+
->header_is('X-Message' => 'it works!')
371380
->content_is('www.example.com');
372381
};
373382

374383
subtest 'Host from myapp.pl with wildcard domain again' => sub {
375-
$t->get_ok('/host' => {Host => 'foo.bar.example.com'})->status_is(200)->header_is('X-Message' => 'it works!')
384+
$t->get_ok('/host' => {Host => 'foo.bar.example.com'})
385+
->status_is(200)
386+
->header_is('X-Message' => 'it works!')
376387
->content_is('foo.bar.example.com');
377388
};
378389

@@ -390,7 +401,9 @@ EOF
390401
};
391402

392403
subtest 'Host from myapp.pl with wildcard domain and Unicode prefix' => sub {
393-
$t->get_ok('/♥/123/host' => {Host => 'foo-bar.de'})->status_is(200)->header_is('X-Message' => 'it works!')
404+
$t->get_ok('/♥/123/host' => {Host => 'foo-bar.de'})
405+
->status_is(200)
406+
->header_is('X-Message' => 'it works!')
394407
->content_is('foo-bar.de');
395408
};
396409

@@ -399,7 +412,9 @@ subtest 'Echo from myapp.pl with wildcard domain and Unicode prefix' => sub {
399412
};
400413

401414
subtest 'Host from myapp.pl with wildcard domain and Unicode prefix again' => sub {
402-
$t->get_ok('/♥/123/host' => {Host => 'www.foo-bar.de'})->status_is(200)->header_is('X-Message' => 'it works!')
415+
$t->get_ok('/♥/123/host' => {Host => 'www.foo-bar.de'})
416+
->status_is(200)
417+
->header_is('X-Message' => 'it works!')
403418
->content_is('www.foo-bar.de');
404419
};
405420

@@ -424,8 +439,10 @@ subtest 'Another invalid domain' => sub {
424439
};
425440

426441
subtest 'Embedded WebSocket' => sub {
427-
$t->websocket_ok('/x/♥/url_for')->send_ok('ws_test')
428-
->message_ok->message_like(qr!^ws://127\.0\.0\.1:\d+/x/%E2%99%A5/url_for$!)->send_ok('index')
442+
$t->websocket_ok('/x/♥/url_for')
443+
->send_ok('ws_test')
444+
->message_ok->message_like(qr!^ws://127\.0\.0\.1:\d+/x/%E2%99%A5/url_for$!)
445+
->send_ok('index')
429446
->message_ok->message_like(qr!^http://127\.0\.0\.1:\d+/x/%E2%99%A5$!)->finish_ok;
430447
};
431448

0 commit comments

Comments
 (0)