Lines 6-12
Link Here
|
6 |
use strict; |
6 |
use strict; |
7 |
use warnings; |
7 |
use warnings; |
8 |
|
8 |
|
9 |
use Test::More tests => 8; |
9 |
use Test::More tests => 10; |
10 |
|
10 |
|
11 |
BEGIN { |
11 |
BEGIN { |
12 |
use_ok('C4::Output::JSONStream'); |
12 |
use_ok('C4::Output::JSONStream'); |
Lines 17-30
is($json->output,'{}',"Making sure JSON output is blank just after its created."
Link Here
|
17 |
$json->param( issues => [ 'yes!', 'please', 'no' ] ); |
17 |
$json->param( issues => [ 'yes!', 'please', 'no' ] ); |
18 |
is($json->output,'{"issues":["yes!","please","no"]}',"Making sure JSON output has added what we told it to."); |
18 |
is($json->output,'{"issues":["yes!","please","no"]}',"Making sure JSON output has added what we told it to."); |
19 |
$json->param( stuff => ['realia'] ); |
19 |
$json->param( stuff => ['realia'] ); |
20 |
is($json->output,'{"issues":["yes!","please","no"],"stuff":["realia"]}',"Making sure JSON output has added more params correctly."); |
20 |
like($json->output,'/"stuff":\["realia"\]/',"Making sure JSON output has added more params correctly."); |
|
|
21 |
like($json->output,'/"issues":\["yes!","please","no"\]/',"Making sure existing elements remain in JSON output"); |
21 |
$json->param( stuff => ['fun','love'] ); |
22 |
$json->param( stuff => ['fun','love'] ); |
22 |
is($json->output,'{"issues":["yes!","please","no"],"stuff":["fun","love"]}',"Making sure JSON output can obverwrite params."); |
23 |
like($json->output,'/"stuff":\["fun","love"\]/',"Making sure JSON output can overwrite params."); |
|
|
24 |
like($json->output,'/"issues":\["yes!","please","no"\]/',"Making non overwitten elements remain in JSON output"); |
23 |
|
25 |
|
24 |
eval{$json->param( die )}; |
26 |
eval{$json->param( die )}; |
25 |
ok($@,'Dies'); |
27 |
ok($@,'Dies'); |
26 |
|
28 |
|
27 |
eval{$json->param( die => ['yes','sure','now'])}; |
29 |
eval{$json->param( die => ['yes','sure','now'])}; |
28 |
ok(!$@,'Dosent die.'); |
30 |
ok(!$@,'Does not die.'); |
29 |
eval{$json->param( die => ['yes','sure','now'], die2 =>)}; |
31 |
eval{$json->param( die => ['yes','sure','now'], die2 =>)}; |
30 |
ok($@,'Dies.'); |
32 |
ok($@,'Dies.'); |
31 |
- |
|
|