Skip to content

Commit

Permalink
Revert "the new -wn option of perltidy looks really nice"
Browse files Browse the repository at this point in the history
This reverts commit b815d56.
  • Loading branch information
kraih committed Jan 3, 2018
1 parent b815d56 commit 71777f2
Show file tree
Hide file tree
Showing 21 changed files with 366 additions and 300 deletions.
1 change: 0 additions & 1 deletion .perltidyrc
Expand Up @@ -9,5 +9,4 @@
-pt=2 # High parenthesis tightness
-bt=2 # High brace tightness
-sbt=2 # High square bracket tightness
-wn # Weld nested containers
-isbc # Don't indent comments without leading space
3 changes: 1 addition & 2 deletions Changes
@@ -1,8 +1,7 @@

7.60 2018-01-03
7.60 2018-01-02
- Deprecated use of Mojo::Promise::all and Mojo::Promise::race as instance
methods.
- Modernized ".perltidyrc".
- Improved all and race methods in Mojo::Promise to be able to handle
arbitrary then-ables.
- Improved number detection in Mojo::JSON with a workaround for an upcoming
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/content.t
Expand Up @@ -17,7 +17,7 @@ $content = Mojo::Content::Single->new(
ok !$content->body_contains('foo'), 'content does not contain "foo"';
ok $content->body_contains('bar'), 'content contains "bar"';
$content = Mojo::Content::Single->new(
{asset => Mojo::Asset::Memory->new->add_chunk('foo')});
{asset => Mojo::Asset::Memory->new->add_chunk('foo')});
ok !$content->body_contains('bar'), 'content does not contain "bar"';
ok $content->body_contains('foo'), 'content contains "foo"';

Expand Down
10 changes: 6 additions & 4 deletions t/mojo/daemon.t
Expand Up @@ -298,10 +298,12 @@ my @accepting;
$acceptor->on(
accept => sub {
my $acceptor = shift;
$loop->next_tick(sub {
push @accepting, $acceptor->is_accepting;
shift->stop if @accepting == 2;
});
$loop->next_tick(
sub {
push @accepting, $acceptor->is_accepting;
shift->stop if @accepting == 2;
}
);
}
);
$loop->client({port => $acceptor->port} => sub { }) for 1 .. 2;
Expand Down
10 changes: 6 additions & 4 deletions t/mojo/delay.t
Expand Up @@ -199,10 +199,12 @@ $delay = Mojo::IOLoop::Delay->new;
$delay->steps(
sub {
my $end = shift->begin;
Mojo::IOLoop->next_tick(sub {
$result = 'pass';
$end->();
});
Mojo::IOLoop->next_tick(
sub {
$result = 'pass';
$end->();
}
);
},
sub { die 'Second step!' },
sub { $result = 'failed' }
Expand Down
16 changes: 10 additions & 6 deletions t/mojo/dom.t
Expand Up @@ -2066,17 +2066,21 @@ $dom->parse(<<EOF);
</c>
EOF
my @results;
$dom->find('b')->each(sub {
$_->find('a')->each(sub { push @results, $_->text });
});
$dom->find('b')->each(
sub {
$_->find('a')->each(sub { push @results, $_->text });
}
);
is_deeply \@results, [qw(bar baz yada)], 'right results';
@results = ();
$dom->find('a')->each(sub { push @results, $_->text });
is_deeply \@results, [qw(foo bar baz yada)], 'right results';
@results = ();
$dom->find('b')->each(sub {
$_->find('c a')->each(sub { push @results, $_->text });
});
$dom->find('b')->each(
sub {
$_->find('c a')->each(sub { push @results, $_->text });
}
);
is_deeply \@results, [qw(baz yada)], 'right results';
is $dom->at('b')->at('a')->text, 'bar', 'right text';
is $dom->at('c > b > a')->text, 'bar', 'right text';
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/headers.t
Expand Up @@ -205,7 +205,7 @@ is_deeply $headers->to_hash(1),
# Multiple headers with the same name
$headers = Mojo::Headers->new;
$headers->from_hash(
{'X-Test' => [23, 24], 'X-Test2' => 'foo', Connection => ['a', 'b']});
{'X-Test' => [23, 24], 'X-Test2' => 'foo', Connection => ['a', 'b']});
$hash = $headers->to_hash;
is $hash->{'X-Test'}, '23, 24', 'right value';
is $hash->{'X-Test2'}, 'foo', 'right value';
Expand Down
48 changes: 28 additions & 20 deletions t/mojo/ioloop.t
Expand Up @@ -17,22 +17,26 @@ is $loop->max_connections, 10, 'right value';

# Double start
my $err;
Mojo::IOLoop->next_tick(sub {
my $loop = shift;
eval { $loop->start };
$err = $@;
$loop->stop;
});
Mojo::IOLoop->next_tick(
sub {
my $loop = shift;
eval { $loop->start };
$err = $@;
$loop->stop;
}
);
Mojo::IOLoop->start;
like $err, qr/^Mojo::IOLoop already running/, 'right error';

# Double one_tick
$err = undef;
Mojo::IOLoop->next_tick(sub {
my $loop = shift;
eval { $loop->one_tick };
$err = $@;
});
Mojo::IOLoop->next_tick(
sub {
my $loop = shift;
eval { $loop->one_tick };
$err = $@;
}
);
Mojo::IOLoop->one_tick;
like $err, qr/^Mojo::IOLoop already running/, 'right error';

Expand Down Expand Up @@ -90,10 +94,12 @@ Mojo::IOLoop->start;
$count = 0;
Mojo::IOLoop->recurring(10 => sub { $timer++ });
my $running;
Mojo::IOLoop->next_tick(sub {
Mojo::IOLoop->reset;
$running = Mojo::IOLoop->is_running;
});
Mojo::IOLoop->next_tick(
sub {
Mojo::IOLoop->reset;
$running = Mojo::IOLoop->is_running;
}
);
Mojo::IOLoop->start;
ok !$running, 'not running';
is $count, 0, 'no recurring events';
Expand Down Expand Up @@ -288,11 +294,13 @@ $loop = Mojo::IOLoop->new->max_connections(2);
my @accepting;
$id = $loop->server(
{address => '127.0.0.1', single_accept => 1} => sub {
shift->next_tick(sub {
my $loop = shift;
push @accepting, $loop->acceptor($id)->is_accepting;
$loop->stop if @accepting == 2;
});
shift->next_tick(
sub {
my $loop = shift;
push @accepting, $loop->acceptor($id)->is_accepting;
$loop->stop if @accepting == 2;
}
);
}
);
$port = $loop->acceptor($id)->port;
Expand Down
2 changes: 1 addition & 1 deletion t/mojo/lib/Mojo/LoaderException.pm
Expand Up @@ -2,7 +2,7 @@ package Mojo::LoaderException;

use Mojo::Base -base;

sub new { }
sub new {}

foo {

Expand Down
20 changes: 10 additions & 10 deletions t/mojo/loader.t
Expand Up @@ -24,16 +24,16 @@ ok !!UNIVERSAL::can(B => 'svref_2object'), 'method found';
my $e = load_class 'Mojo::LoaderException';
isa_ok $e, 'Mojo::Exception', 'right exception';
like $e->message, qr/Missing right curly/, 'right message';
is $e->lines_before->[0][0], 4, 'right number';
is $e->lines_before->[0][1], '', 'right line';
is $e->lines_before->[1][0], 5, 'right number';
is $e->lines_before->[1][1], 'sub new { }', 'right line';
is $e->lines_before->[2][0], 6, 'right number';
is $e->lines_before->[2][1], '', 'right line';
is $e->lines_before->[3][0], 7, 'right number';
is $e->lines_before->[3][1], 'foo {', 'right line';
is $e->lines_before->[4][0], 8, 'right number';
is $e->lines_before->[4][1], '', 'right line';
is $e->lines_before->[0][0], 4, 'right number';
is $e->lines_before->[0][1], '', 'right line';
is $e->lines_before->[1][0], 5, 'right number';
is $e->lines_before->[1][1], 'sub new {}', 'right line';
is $e->lines_before->[2][0], 6, 'right number';
is $e->lines_before->[2][1], '', 'right line';
is $e->lines_before->[3][0], 7, 'right number';
is $e->lines_before->[3][1], 'foo {', 'right line';
is $e->lines_before->[4][0], 8, 'right number';
is $e->lines_before->[4][1], '', 'right line';
is $e->line->[0], 9, 'right number';
is $e->line->[1], "1;", 'right line';
like "$e", qr/Missing right curly/, 'right message';
Expand Down
10 changes: 6 additions & 4 deletions t/mojo/log.t
Expand Up @@ -41,10 +41,12 @@ like $log->format->(time, 'debug', qw(Test 1 2 3)),
qr/^\[.*\] \[debug\] Test\n1\n2\n3\n$/, 'right format';
like $log->format->(time, 'error', 'I ♥ Mojolicious'),
qr/^\[.*\] \[error\] I ♥ Mojolicious\n$/, 'right format';
$log->format(sub {
my ($time, $level, @lines) = @_;
return join ':', $level, $time, @lines;
});
$log->format(
sub {
my ($time, $level, @lines) = @_;
return join ':', $level, $time, @lines;
}
);
like $log->format->(time, 'debug', qw(Test 1 2 3)), qr/^debug:\d+:Test:1:2:3$/,
'right format';

Expand Down

0 comments on commit 71777f2

Please sign in to comment.