You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use Mojo::Base -strict;
use Mojolicious::Lite;
use Test::Mojo;
use Test::More;
my$t = Test::Mojo->new();
get '/json'=>sub {
my$self = shift;
$self->render_json( { key1=>'value1', key2=>'value2' } );
};
$t->get_ok('/json')->json_is('/key1'=>'value1', 'Correct');
$t->get_ok('/json')->json_is('/key1'=>'value2', 'Should fail with [got:"value1"; expected="value2"]');
$t->get_ok('/json')->json_is('/key3'=>'value2', 'Should fail with [got:""; expected="value2"]');
done_testing;
Current result of
"$t->get_ok('/json')->json_is('/key3' => 'value2', 'Should fail with [got:""; expected="value2"]');"
is:
not ok 6
# Failed test at basic.t line 16.
# got: 'value2'
# expected: 'Should fail with [got:""; expected="value2"]'
But it should be
not ok 6 - Should fail with [got:""; expected="value2"]
# Failed test 'Should fail with [got:"value1"; expected="value2"]'
# at basic.t line 15.
# got: ''
# expected: 'value2'
The text was updated successfully, but these errors were encountered:
Here is small test:
Current result of
"$t->get_ok('/json')->json_is('/key3' => 'value2', 'Should fail with [got:""; expected="value2"]');"
is:
But it should be
The text was updated successfully, but these errors were encountered: