Skip Menu |

This queue is for tickets about the PGObject-Type-JSON CPAN distribution.

Report information
The Basics
Id: 125708
Status: open
Priority: 0/
Queue: PGObject-Type-JSON

People
Owner: Nobody in particular
Requestors: ntyni [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.000001
Fixed in: (no value)



Subject: t/02-serialization.t failure with newer JSON::PP
Hi, we're seeing a failure in t/02-serialization.t with newer versions of JSON-PP, at least 2.97001. I've brought up this change of behaviour in https://github.com/makamaka/JSON-PP/issues/39 but had no answer yet. I don't know why this is not showing up in CPAN tester reports, maybe JSON::XS is installed and masks it or something? It's perfectly reproducible for me on Debian with both Perl 5.26.2 and 5.28.0. t/02-serialization.t .. 1..23 ok 1 - Instantiate null ok 2 - Null is a JSON object ok 3 - Null is a scalar ok 4 - Serializes to db as null ok 5 - Null is not undef ok 6 - Instantiate undef ok 7 - Undef isa JSON object ok 8 - Undef is scalar ok 9 - Serializes to db as undef ok 10 - undef is undef ok 11 - Instantiate hashref ok 12 - Hashref is a JSON object ok 13 - Hashref is a HASH ok 14 - Serialization of hashtest works ok 15 - Hash foo element is 1 ok 16 - Hash bar element is 2 ok 17 - Instantiate arrayref ok 18 - Array is ARRAY ok 19 - Array is correct array ok 20 - Array serializes to db correctly ok 21 - Instantiate literal ok 22 - Literal is SCALAR not ok 23 - Literal serializes correctly # Failed test 'Literal serializes correctly' # at t/02-serialization.t line 49. # got: '123' # expected: '"123"' # Looks like you failed 1 test of 23. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/23 subtests
On Fri Jun 29 07:02:00 2018, ntyni@debian.org wrote: Show quoted text
> Hi, we're seeing a failure in t/02-serialization.t with newer versions > of JSON-PP, at least 2.97001. I've brought up this change of behaviour > in https://github.com/makamaka/JSON-PP/issues/39 but had no answer > yet. > > I don't know why this is not showing up in CPAN tester reports, maybe > JSON::XS is installed and masks it or something? It's perfectly > reproducible for me on Debian with both Perl 5.26.2 and 5.28.0. > > > t/02-serialization.t ..
Show quoted text
> ok 22 - Literal is SCALAR > not ok 23 - Literal serializes correctly > > # Failed test 'Literal serializes correctly' > # at t/02-serialization.t line 49. > # got: '123' > # expected: '"123"' > # Looks like you failed 1 test of 23. > Dubious, test returned 1 (wstat 256, 0x100) > Failed 1/23 subtests
Ok so the problem here is that we expect a literal string and the module you are using serializes as a number. Given Perl's type system I don't see an easy way around this other than perhaps to normalize the result by stripping off leading and trailing double quotes (once!) if they exist.
Show quoted text
> > # Failed test 'Literal serializes correctly' > > # at t/02-serialization.t line 49. > > # got: '123' > > # expected: '"123"' > > # Looks like you failed 1 test of 23. > > Dubious, test returned 1 (wstat 256, 0x100) > > Failed 1/23 subtests
> > Ok so the problem here is that we expect a literal string and the > module you are using serializes as a number. Given Perl's type system > I don't see an easy way around this other than perhaps to normalize > the result by stripping off leading and trailing double quotes (once!) > if they exist.
Can't Test2::Bundle::More help here? what about is("123", number(123), "Use a numeric comparison"); ?