File: basic.t

package info (click to toggle)
libjson-types-perl 0.05-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 216 kB
  • sloc: perl: 1,435; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
use warnings;
use Test::More;

use JSON;
use JSON::Types;

my $obj = 123;
is encode_json([ $obj ]), '[123]', 'number data ok';
is encode_json([ string $obj ]), '["123"]', 'to string ok';

$obj = "123";
is encode_json([ $obj ]), '["123"]', 'string data ok';
is encode_json([ number $obj ]), '[123]', 'to number ok';

is encode_json([ bool $obj ]), '[true]', 'to true ok';
is encode_json([ bool !$obj ]), '[false]', 'to false ok';

done_testing;