From 434d9a3c66c54c028c971a0bd59312d099ba358a Mon Sep 17 00:00:00 2001 From: Zach Sim Date: Fri, 21 Jan 2011 09:16:28 +1300 Subject: [PATCH] Bug 5327: Added unit tests to Output_JSONStream.t Signed-off-by: Chris Cormack --- t/Output_JSONStream.t | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/t/Output_JSONStream.t b/t/Output_JSONStream.t index 2ee22fe9c3..e18f7925ac 100755 --- a/t/Output_JSONStream.t +++ b/t/Output_JSONStream.t @@ -6,9 +6,17 @@ use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 5; BEGIN { use_ok('C4::Output::JSONStream'); } +my $json = new C4::Output::JSONStream; +is($json->output,'{}',"Making sure JSON output is blank just after its created."); +$json->param( issues => [ 'yes!', 'please', 'no' ] ); +is($json->output,'{"issues":["yes!","please","no"]}',"Making sure JSON output has added what we told it to."); +$json->param( stuff => ['realia'] ); +is($json->output,'{"issues":["yes!","please","no"],"stuff":["realia"]}',"Making sure JSON output has added more params correctly."); +$json->param( stuff => ['fun','love'] ); +is($json->output,'{"issues":["yes!","please","no"],"stuff":["fun","love"]}',"Making sure JSON output can obverwrite params."); -- 2.39.2