Debian Codegraph @

t/dsl/json.t

raw
1 use strict;
2 use warnings;
3 use Test::More tests => 2;
4 use Plack::Test;
5 use HTTP::Request::Common;
6
7 {
8 package App;
9 use Dancer2;
10 get '/' => sub {
11 my $app = app;
12
13 my %test = (foo => 'bar');
14
15 ::is( encode_json(\%test), '{"foo":"bar"}', 'encode_json works' );
16 ::is_deeply( decode_json(encode_json(\%test)), \%test, 'decode_json works' );
17 };
18 }
19
20 Plack::Test->create( App->to_app )->request( GET '/' );