test 'content_isnt' => sub {
$t->content_isnt('Goodbye Test!');
is_deeply \@args, ['isnt', 'Hello Test!', 'Goodbye Test!', 'no match for content'], 'right result';
$t->content_isnt('Goodbye Test
!', 'some description');
is_deeply \@args, ['isnt', 'Hello Test!', 'Goodbye Test!', 'some description'], 'right result';
};
subtest 'content_like' => sub {
$t->content_like(qr/Hello Test!/);
is
ype_isnt' => sub {
$t->content_type_isnt('image/png');
is_deeply \@args, ['isnt', 'text/html;charset=UTF-8', 'image/png', 'not Content-Type: image/png'], 'right result';
$t->content_type_isnt('i
mePlugin2::register (security violation)
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(404)->status_is(500)
->header_is(Server => 'Mojolicious (Perl)')->content_unlike(qr/Something/)
$logs = $t->app->log->capture('trace');
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(404)->status_is(500)
->header_is(Server => 'Mojolicious (Perl)')->content_unlike(qr/Something/)
t->get_ok($url => {'X-Test' => 'Hi there!'})->status_isnt(404)->status_is(200)->status_is(200, 'with description')
->status_isnt(500)->status_isnt(500, 'with description')->header_is('X-Bender' => u
Mojo::UserAgent::Server->app, app, 'applications are equal');
my $dummy = Mojolicious::Lite->new;
isnt(Mojo::UserAgent->new->server->app($dummy)->app, app, 'applications are not equal');
is(Mojo::User
status';
is $tx->res->headers->content_encoding, 'gzip', 'right "Content-Encoding" value';
isnt $tx->res->body, 'Hello GZip!', 'different content';
# Keep-alive timeout in b
e';
is $tx->res->body, 'works!', 'right content';
isnt $tx->connection, $last, 'new connection';
isnt $ua->server->url->port, $port, 'new port';
my $port2 = $ua-
set';
is $frame->[4], 1, 'text frame';
is $frame->[5], 'also works', 'right payload';
isnt(build_frame(0, 1, 0, 0, 0, 2, 'also works'), $bytes, 'frames are not equal');
# Masked binary fr
et';
is $frame->[4], 2, 'binary frame';
is $frame->[5], 'just works', 'right payload';
isnt(build_frame(0, 1, 0, 0, 0, 2, 'just works'), $bytes, 'frames are not equal');
# One-character te
0, 'rsv3 flag is not set';
is $frame->[4], 2, 'binary frame';
is $frame->[5], '', 'no payload';
isnt(build_frame(0, 1, 0, 0, 0, 2, ''), $bytes, 'frames are not equal');
# Size limit
$bytes = build_
oxy-Authorization" value';
is $tx->res->body, $last, 'right content';
isnt(Mojo::IOLoop->stream($tx->connection)->handle->sockport, $last, 'different ports');
my $before
status';
is $tx->res->body, $last, 'right content';
is $before, $last, 'same port';
isnt(Mojo::IOLoop->stream($tx->connection)->handle->sockport, $last, 'different ports');
};
subtest '
$tx->send('test');
}
);
Mojo::IOLoop->start;
is $result, $last, 'right result';
isnt(Mojo::IOLoop->stream($id)->handle->sockport, $last, 'different ports');
};
subtest 'HTTPS reques
$t = Test::Mojo->new;
subtest 'Normal route' => sub {
$t->get_ok('/')->status_is(200)->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')->content_is('works');
};
subtest 'Normal sta
};
subtest ' Custom response' => sub {
$t->get_ok('/res.txt?route=1')->status_is(202)->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
->content_is('Custom response!');
};
sub
st 'Conditional response' => sub {
$t->get_ok('/res.txt?route=1&res=1')->status_is(201)->header_isnt('Cache-Control' => 'max-age=3600, must-revalidate')
->content_is('Conditional response!');
};
age_ok->message_is({binary => 'bytes!'})
->send_ok({binary => 'bytes!'})->message_ok->message_isnt({text => 'bytes!'})->finish_ok;
};
subtest 'Bytes in multiple frames' => sub {
$t->websocket_o
->message_is('[1,2,3,4]')->message_is('[1,2,3,4]', 'with description')->message_isnt('[1,2,3]')
->message_isnt('[1,2,3]', 'with description')->message_like(qr/3/)->message_like(qr/3/, 'with des
inish_ok;
$t->websocket_ok('/push')->message_ok->message_unlike(qr/shift/)->message_ok->message_isnt('shift')
->message_ok->message_like(qr/us/)->message_ok->message_unlike({binary => qr/push/})
s(Location => undef)
->element_exists('#☃')->element_exists_not('#foo')->text_isnt('#foo' => 'whatever')->text_isnt('div#☃' => 'Redirect')
->text_is('div#☃' => 'Redirect works!')->text_unlik
olve($promise)), refaddr($promise), 'same object';
$promise = Mojo::Promise->resolve('foo');
isnt refaddr(Mojo::Promise->new->resolve($promise)), refaddr($promise), 'different object';
$promis
w->ioloop($loop)->resolve }, 1);
is $promise->ioloop, $loop, 'same loop';
isnt $promise->ioloop, Mojo::IOLoop->singleton, 'not the singleton';
$promise->then(sub { $ok = 1; $
ed' unless eval { symlink $orig, $link };
is $link->stat->size, 0, 'target file is empty';
isnt $link->lstat->size, 0, 'link is not empty';
};
subtest 'list/list_tree' => sub {
is_deeply pat
e $future, $future, $file->to_string;
is $file->stat->mtime, $future, 'right mtime';
isnt $file->touch->stat->mtime, $future, 'different mtime';
};
subtest 'Dangerous paths' => sub {
e
mePlugin2::register (security violation)
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(404)->status_is(500)
->header_is(Server => 'Mojolicious (Perl)')->content_like(qr/Not developme
in2::register (security violation again)
$t->get_ok('/plugin-test-some_plugin2/register')->status_isnt(404)->status_is(500)
->header_is(Server => 'Mojolicious (Perl)')->content_like(qr/Not developme
content';
};
subtest 'clone' => sub {
my $stream = b('foo');
my $clone = $stream->clone;
isnt $stream->b64_encode->to_string, 'foo', 'original changed';
is $clone->to_string,
' => sub {
my $uncompressed = b('a' x 1000);
my $compressed = $uncompressed->clone->gzip;
isnt $compressed->to_string, $uncompressed->to_string, 'bytestream changed';
ok $compressed->size <
not kept alive';
is $tx->res->code, 200, 'right status';
my $second = $tx->res->body;
isnt $first, $second, 'different content';
like $second, qr/Hello World \d+!/, 'right content';
f Mojolicious::Commands->new->run, 'CODE', 'right reference';
local $ENV{MOJO_NO_DETECT} = 1;
isnt ref Mojolicious::Commands->new->run, 'CODE', 'not a CODE reference';
}
# Run command
is ref Mojo
m = $collection->shuffle;
is $collection->size, $random->size, 'same number of elements';
isnt "@$collection", "@$random", 'different order';
is_deeply c()->shuffle->to_array, [], 'no el
$script], 'file has changed';
ok((stat $script)[9] == $mtime, 'modify time has not changed');
isnt((stat $script)[7], $size, 'size has changed');
sleep 0.1 until -f $started;
# Application ha
ket::INET->new(PeerAddr => 'mojolicious.org', PeerPort => 80);
my $address = $sock->sockhost;
isnt $address, '127.0.0.1', 'different address';
$ua->max_connections(0)->socket_options->{LocalAddr
$clone = $params->clone;
is "$params", "$clone", 'equal parameters';
push @$clone, c => 9;
isnt "$params", "$clone", 'unequal parameters';
};
subtest 'Merge' => sub {
my $params = Mojo::Par
$c->res->headers->content_encoding, 'gzip', 'right "Content-Encoding" value';
isnt $c->res->body, $output, 'different string';
is gunzip($c->re
gzip/gunzip' => sub {
my $uncompressed = 'a' x 1000;
my $compressed = gzip $uncompressed;
isnt $compressed, $uncompressed, 'string changed';
ok length $compressed < length $uncompressed, 'st