Bugzilla – Attachment 23981 Details for
Bug 11480
Tests in Output_JSON.t make invalid assumptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11480 Fix invalid assumptions in test
Bug-11480-Fix-invalid-assumptions-in-test.patch (text/plain), 2.65 KB, created by
Chris Cormack
on 2014-01-07 01:31:47 UTC
(
hide
)
Description:
Bug 11480 Fix invalid assumptions in test
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-01-07 01:31:47 UTC
Size:
2.65 KB
patch
obsolete
>From 848789d3f6510250f0c10c718987a500a6cf24d8 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Mon, 6 Jan 2014 16:53:33 +0000 >Subject: [PATCH] Bug 11480 Fix invalid assumptions in test > >Tests for Output::JSON made the invalid assumption >that the hash keys of the modules internal structure >will always be returned in the same sequence. >A hash is an unordered structure. as of perl 5.18 >this has beem reinforced by random seeding of the >hashing function. See the info in perldelta and >the doc for JSON > >This patch changes the tests to be sequence neutral >where the previous test was testing that a new element >was added and an existing one was untouched these have >been separated into individual tests. >Some typos in the messages have been corrected > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> > >Test Plan > >1/ Run t/Output_JSONStream.t , 8 tests should pass (or perhaps fail, but inconsistently >under perl 5.18 or greater) >2/ Apply patch >3/ Run t/Output_JSONStream.t 10 tests should pass now >--- > t/Output_JSONStream.t | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > >diff --git a/t/Output_JSONStream.t b/t/Output_JSONStream.t >index 1d0cf35..13702a6 100755 >--- a/t/Output_JSONStream.t >+++ b/t/Output_JSONStream.t >@@ -6,7 +6,7 @@ > use strict; > use warnings; > >-use Test::More tests => 8; >+use Test::More tests => 10; > > BEGIN { > use_ok('C4::Output::JSONStream'); >@@ -17,14 +17,16 @@ 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."); >+like($json->output,'/"stuff":\["realia"\]/',"Making sure JSON output has added more params correctly."); >+like($json->output,'/"issues":\["yes!","please","no"\]/',"Making sure existing elements remain in JSON output"); > $json->param( stuff => ['fun','love'] ); >-is($json->output,'{"issues":["yes!","please","no"],"stuff":["fun","love"]}',"Making sure JSON output can obverwrite params."); >+like($json->output,'/"stuff":\["fun","love"\]/',"Making sure JSON output can overwrite params."); >+like($json->output,'/"issues":\["yes!","please","no"\]/',"Making non overwitten elements remain in JSON output"); > > eval{$json->param( die )}; > ok($@,'Dies'); > > eval{$json->param( die => ['yes','sure','now'])}; >-ok(!$@,'Dosent die.'); >+ok(!$@,'Does not die.'); > eval{$json->param( die => ['yes','sure','now'], die2 =>)}; > ok($@,'Dies.'); >-- >1.8.5.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11480
:
23973
|
23981
|
24136