commit perl-Cpanel-JSON-XS for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Cpanel-JSON-XS for openSUSE:Factory checked in at 2024-06-28 15:47:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS (Old) and /work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new.18349 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Cpanel-JSON-XS" Fri Jun 28 15:47:09 2024 rev:39 rq:1183669 version:4.380.0 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS/perl-Cpanel-JSON-XS.changes 2023-07-12 17:27:28.434553709 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new.18349/perl-Cpanel-JSON-XS.changes 2024-06-28 15:49:20.235024094 +0200 @@ -1,0 +2,11 @@ +Sun Jun 23 16:13:17 UTC 2024 - Tina Müller <tina.mueller@suse.com> + +- updated to 4.380.0 (4.38) + see /usr/share/doc/packages/perl-Cpanel-JSON-XS/Changes + + 4.38 2024-05-27 (rurban) + - Encode real core booleans as boolean notation (PR #224 leonerd) + - Minor test fixes by leonerd + - Fix docs typo (PR #225 karenetheridge) + +------------------------------------------------------------------- Old: ---- Cpanel-JSON-XS-4.37.tar.gz New: ---- Cpanel-JSON-XS-4.38.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Cpanel-JSON-XS.spec ++++++ --- /var/tmp/diff_new_pack.cKHi8S/_old 2024-06-28 15:49:22.895120345 +0200 +++ /var/tmp/diff_new_pack.cKHi8S/_new 2024-06-28 15:49:22.899120489 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Cpanel-JSON-XS # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,16 +18,20 @@ %define cpan_name Cpanel-JSON-XS Name: perl-Cpanel-JSON-XS -Version: 4.37 +Version: 4.380.0 Release: 0 +# 4.38 -> normalize -> 4.380.0 +%define cpan_version 4.38 License: Artistic-1.0 OR GPL-1.0-or-later Summary: CPanel fork of JSON::XS, fast and correct serializing URL: https://metacpan.org/release/%{cpan_name} -Source0: https://cpan.metacpan.org/authors/id/R/RU/RURBAN/%{cpan_name}-%{version}.tar.gz +Source0: https://cpan.metacpan.org/authors/id/R/RU/RURBAN/%{cpan_name}-%{cpan_version}.tar.gz Source1: cpanspec.yml BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Time::Piece) +Provides: perl(Cpanel::JSON::XS) = %{version} +%undefine __perllib_provides %{perl_requires} %description @@ -47,7 +51,7 @@ and vice versa. %prep -%autosetup -n %{cpan_name}-%{version} +%autosetup -n %{cpan_name}-%{cpan_version} find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644 ++++++ Cpanel-JSON-XS-4.37.tar.gz -> Cpanel-JSON-XS-4.38.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/.github/workflows/testsuite.yml new/Cpanel-JSON-XS-4.38/.github/workflows/testsuite.yml --- old/Cpanel-JSON-XS-4.37/.github/workflows/testsuite.yml 2023-02-21 17:20:32.000000000 +0100 +++ new/Cpanel-JSON-XS-4.38/.github/workflows/testsuite.yml 2024-05-28 09:41:28.000000000 +0200 @@ -64,6 +64,8 @@ matrix: perl-version: [ + #"5.40", + "5.38", "5.36", "5.34", "5.32", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/Changes new/Cpanel-JSON-XS-4.38/Changes --- old/Cpanel-JSON-XS-4.37/Changes 2023-07-04 12:31:38.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/Changes 2024-05-28 09:28:16.000000000 +0200 @@ -2,6 +2,11 @@ TODO: http://stevehanov.ca/blog/index.php?id=104 compression +4.38 2024-05-27 (rurban) + - Encode real core booleans as boolean notation (PR #224 leonerd) + - Minor test fixes by leonerd + - Fix docs typo (PR #225 karenetheridge) + 4.37 2023-07-04 (rurban) - Fix NAN/INF for AIX (Tux: AIX-5.3, tested by XSven on AIX-7.3) GH #165 - Fix empty string result in object stringification (PR #221 jixam) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/META.json new/Cpanel-JSON-XS-4.38/META.json --- old/Cpanel-JSON-XS-4.37/META.json 2023-07-04 12:35:22.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/META.json 2024-05-28 09:42:05.000000000 +0200 @@ -100,7 +100,7 @@ "url" : "https://github.com/rurban/Cpanel-JSON-XS" } }, - "version" : "4.37", + "version" : "4.38", "x_contributors" : [ "Ashley Willis <ashleyw@cpan.org>", "Chip Salzenberg <chip@pobox.com>", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/META.yml new/Cpanel-JSON-XS-4.38/META.yml --- old/Cpanel-JSON-XS-4.37/META.yml 2023-07-04 12:35:21.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/META.yml 2024-05-28 09:42:05.000000000 +0200 @@ -48,7 +48,7 @@ bugtracker: https://github.com/rurban/Cpanel-JSON-XS/issues license: http://dev.perl.org/licenses/ repository: https://github.com/rurban/Cpanel-JSON-XS -version: '4.37' +version: '4.38' x_contributors: - 'Ashley Willis <ashleyw@cpan.org>' - 'Chip Salzenberg <chip@pobox.com>' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/README new/Cpanel-JSON-XS-4.38/README --- old/Cpanel-JSON-XS-4.37/README 2023-07-04 12:35:22.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/README 2024-05-28 09:42:06.000000000 +0200 @@ -633,9 +633,10 @@ $json = $json->unblessed_bool([$enable]) If $enable is true (or missing), then "decode" will return Perl - non-object boolean variables (1 and 0) for JSON booleans ("true" and - "false"). If $enable is false, then "decode" will return - "JSON::PP::Boolean" objects for JSON booleans. + non-object boolean variables (1 and 0 as numbers or "1" and "" as + strings) for JSON booleans ("true" and "false"). If $enable is + false, then "decode" will return "JSON::PP::Boolean" objects for + JSON booleans. $json = $json->allow_singlequote ([$enable]) $enabled = $json->get_allow_singlequote @@ -1066,7 +1067,7 @@ parentheses. The only thing it guarantees is that it starts decoding as soon as a syntactically valid JSON text has been seen. This means you need to set resource limits (e.g. "max_size") to ensure the parser will - stop parsing in the presence if syntax errors. + stop parsing in the presence of syntax errors. The following methods implement this incremental parser. @@ -2134,9 +2135,9 @@ SEE ALSO The cpanel_json_xs command line utility for quick experiments. - JSON, JSON::XS, JSON::MaybeXS, Mojo::JSON, Mojo::JSON::MaybeXS, - JSON::SL, JSON::DWIW, JSON::YAJL, JSON::Any, Test::JSON, - Locale::Wolowitz, <https://metacpan.org/search?q=JSON> + JSON::PP, JSON, JSON::XS, JSON::MaybeXS, Mojo::JSON, + Mojo::JSON::MaybeXS, JSON::SL, JSON::DWIW, JSON::YAJL, JSON::Any, + Test::JSON, Locale::Wolowitz, <https://metacpan.org/search?q=JSON> <https://tools.ietf.org/html/rfc7159> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/SIGNATURE new/Cpanel-JSON-XS-4.38/SIGNATURE --- old/Cpanel-JSON-XS-4.37/SIGNATURE 2023-07-04 12:35:22.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/SIGNATURE 2024-05-28 09:42:06.000000000 +0200 @@ -16,18 +16,18 @@ SHA256 aac2b4bbaa7b93eaf72300f60e167a17e05adcd721087f735ba55d2900f31490 .appveyor.yml SHA256 082201a3cbd62a55f2e58ffbb991c4b2bb806de0009bc9497ffcc07202f60855 .github/FUNDING.yml -SHA256 136c5a00ee7c7425150f18013743e7b0d30339eca0f08901d4cf6b8731a6b017 .github/workflows/testsuite.yml +SHA256 724cc9e03083bc4d51ec2659118a9bb7ca66ca5f640a1d249ae3732d68511380 .github/workflows/testsuite.yml SHA256 a3c34aba52e269e6cec558ecf9cff393138574189fdff26b183bee9cc2e0434f .travis.yml SHA256 c3f2a1a4f66382f796f71a571946722edba53cf3238152b26fd325f4c2f1a20f .whitesource SHA256 8de3540a3cd7ecc9a9dcb48975fe852c082fe17d4462f87bb72aa7cc47f083ad COPYING -SHA256 a0c1df3ac89bec04046fe55c39cd20773a4d6f104e76508ef2c688dfc3db6dfa Changes +SHA256 b71855f20be1a971331ac839669343879f5060566f7b6d99eb1b3e780016ba95 Changes SHA256 a5378ebe65273d49047a21e94af087f70a303793ffed2a695c800ed965ac185d MANIFEST -SHA256 ec3a3db51c59096cc14f7712986e3ab2e4027a40f3cc1faf9be69553c172e32c META.json -SHA256 c76fb8cf23082da8da4f9ffff46a25501af0c2769a6dbf9fbeeaf0f32d536b0a META.yml +SHA256 54b5e4bb0941990541d28feb3bef935550223d01d72ce0fea6ef5b055e7fa4cf META.json +SHA256 4e077751414fae1237385450b8552236fc6b9238c8a5b6df80358f305a38f1cb META.yml SHA256 31d74c68c91639bc34e18541091616d226713c6c49168d42eefab58535f5cd4a Makefile.PL -SHA256 2eb1d8124526462c3afb4089a09a36d2e22da1b931a859f1ec06bec81d8a4245 README -SHA256 cf86fbae8a2abeadbd634c40b126f390077dd4a97bd54e2a8ec7311e9e9d71ae XS.pm -SHA256 21e00e79d18a7320df51dbc7a053052602d30659475a95bbbd366cb1d61a3f21 XS.xs +SHA256 98e8b94a1144b556c9158578d196aacbcd607403708b46be407c1d646f89725d README +SHA256 19f04b9e274d822cca292642ecb758f2745b13d8589ac3cf8bbbdb951fc69740 XS.pm +SHA256 993872004c4d1dafd67cd2aaacbda4065cf418ec5a4b9b25a7c236ff94720003 XS.xs SHA256 c95e4b970183cbd6d1ec9c88c37a80f12bd2b66ed6be3c008ffd578d2f622c01 XS/Boolean.pm SHA256 20596259e7e399ed1984a469a9a907be878499406d5285a11f1ab98f93aff44f XS/Type.pm SHA256 2f34a530b7ce981b0df9aacd2b6944ccf74c4a7f8bb49fde57b342663e7feb26 bin/cpanel_json_xs @@ -73,12 +73,12 @@ SHA256 1585a6aecec5c73b7a6f70982b3bcc1edc1d63ca55467223ab0d6f0956254bc4 t/18_json_checker.t SHA256 9f9006c1f925d9ace7d1621e1479c21f9b50459ab57aa0046209fed2b3e66530 t/19_incr.t SHA256 dde73ed3cfc0e28d064f61fc08871accf88b780aee06a3cb0040f59f04c1ff36 t/20_faihu.t -SHA256 fcac4365f8d9ba099ea90b6442eb205433d8419ffda5be82d66f5d69c3cdefe3 t/20_unknown.t +SHA256 56e11977ce3d544f8c8e62a38cbcc4f58f7f1d53b71918f803536acd62122713 t/20_unknown.t SHA256 388f8e0f0e41c9921aedc67313f8b89bdd08b95ced0dba242986d3b76d9a1688 t/21_evans.t SHA256 3da823eab55abb6dca05e8bc6111d3b59ea18c4ee270baf6413d9a45042ff48c t/22_comment_at_eof.t SHA256 2a6506fb07b27b1fef52b251d3876d23bd572596ff487d37c2f6597be554836c t/23_array_ctx.t SHA256 a8dfccba0b60b0fc91812fcfd96656e993abb74970509926d738c67a58641f01 t/24_freeze_recursion.t -SHA256 3d81e94b5d3407ba3df47ccace0aaf8f16bad9da3016e74f653e150629ce5b36 t/25_boolean.t +SHA256 d6e46428bf221ea9bca6f8c0a9d14ee76305d91e01d9946b570aac125d392ba8 t/25_boolean.t SHA256 e7297f97fe3fea65c865658675b72e667b37b201e7fec8b8128f2006f8999d86 t/26_duplicate.t SHA256 03a2061b4742ea591961a4ce7403feac91998c0909dbde982c465ce3d2c39706 t/30_jsonspec.t SHA256 cf2181a691d5e1862d71e4e902928a0d899b9671e3633584efa8ae3f5cc0d174 t/31_bom.t @@ -88,7 +88,7 @@ SHA256 f542b8cfd2bee5ab9ae92dd042e3bbf68a968ae959d0eeada43cd5cd53c8337a t/55_modifiable.t SHA256 7e825a17dc348ddee2b61e686a670115c31d80f372a7614e27811b9f3d795c79 t/96_interop.t SHA256 f720857c5fb03c62aab4765610ab05326e5139505f823400605abaebedffeb32 t/96_interop_pp.t -SHA256 ddf64cc8fddcf0d2b32c34b2969730a955869edf51b4157a3d3591334dd6b8de t/96_mojo.t +SHA256 40683e1922b62e46053ee60bf4c94e2ca9dbbe0da9d3131c16b4ef49045feb0a t/96_mojo.t SHA256 f847d17e014f19232281a3f44184da5f6dc0d1efb2d817d03156d1ff3d152afa t/97_unshare_hek.t SHA256 6b6c59c5f260f28afca3ccfe0785fb8da328ee3aa259079ef5dd982822862726 t/98_56only.t SHA256 fc880ee039642bcb1517cdb4afaa8060471785b521df45d295b50041137211e5 t/99_binary.t @@ -446,12 +446,15 @@ SHA256 aca6f846869ab2e4881e807739086e1535b1438bd0e23d7a021360742736a6a9 xt/pod.t -----BEGIN PGP SIGNATURE----- -iQEzBAEBAwAdFiEEKJWogdNCcPq/6PdHtPYzOeZdZBQFAmSj9eoACgkQtPYzOeZd -ZBTP2wf8DlABhDoQ9mJCIILTVANIlJzE4HcTDwVczvLVSo9q7nBkuRC0HQoh8tfg -vl6zPgFLNEpjES2kYUQsjNxdrOJ06lB1n2Bm5G3BrSxCHg5oEQ5RPukDcTbWF1Mx -6uZvtUWCoP5lsUdJ5QqM4fhNDf9iXkY+14EZGMwPj2ia07gkbo7vf2v6vpSIvmze -dKRP7finLl+mPpBTXZtJ6REva/Ip5BFfxKdCpbVqOSmcCJ3bBkw1MT4UDalhmr9n -3bOliBpZa2Wx12jWk6Iewqw68p+jCjT6dNmA1Q3Ct+ii9ihYkVuCV6vGY1WCHpCl -C4xy/13TfjfQ5ZjfhVOeXF8OAHiIrA== -=bfLU +iQGzBAEBAwAdFiEEOKQWew22nknF9yFsuMKIZqsnp6IFAmZVis0ACgkQuMKIZqsn +p6L0fQv/fxqsl/qUJlP7VF+cB3aoYxREZb5zO0o8EgtUh/0WJqIRh1HCtIFvqS6A +H+C38UI74jVF/HW9m2MHrdG2+uhfQtIPA1AYSY5/HhiDXPY5/yLzOghXeDOtFCIV +57AUvwcatdDbZdBHHAjdFjmId44ytw+CegIc7DS0iX3x5xfUq83RDASFvQ0KBnaM +e+0zwwn8WEAugRN4T1WLIDOVH+XpfpmeaPTXq0+k1F5EceemhLtSSgApLt5uwwnJ +EI8GGMrmqDj7D4qVm8x8i0S321I91S8qunQ/8eZqmX4eXTHLs/xr06bQswBHVYXG +ZSEBm/Igl2Uklg1+0I3mfPM91weFLGgziN8upSevyW43P1czOx5/w979yozLXzNw +zRUHXbCuzFjXiHMLO0mKVJ2iD/Pi5qg7X3gLFhVKDOoS+sigoyMyKtkjERsTEnVb +kO+TbbmydKag54VUsZt8XUaSO0CgchXbJ1Cc46wL0zaNEtFeUKVwG1Bqv/4HDiX7 +kALat5WQ +=upNl -----END PGP SIGNATURE----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/XS.pm new/Cpanel-JSON-XS-4.38/XS.pm --- old/Cpanel-JSON-XS-4.37/XS.pm 2023-07-04 12:31:38.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/XS.pm 2024-05-28 09:28:16.000000000 +0200 @@ -1,5 +1,5 @@ package Cpanel::JSON::XS; -our $VERSION = '4.37'; +our $VERSION = '4.38'; our $XS_VERSION = $VERSION; # $VERSION = eval $VERSION; @@ -731,10 +731,11 @@ $json = $json->unblessed_bool([$enable]) -If C<$enable> is true (or missing), then C<decode> will return -Perl non-object boolean variables (1 and 0) for JSON booleans -(C<true> and C<false>). If C<$enable> is false, then C<decode> -will return C<JSON::PP::Boolean> objects for JSON booleans. +If C<$enable> is true (or missing), then C<decode> will return Perl +non-object boolean variables (1 and 0 as numbers or "1" and "" as +strings) for JSON booleans (C<true> and C<false>). If C<$enable> is +false, then C<decode> will return C<JSON::PP::Boolean> objects for +JSON booleans. =item $json = $json->allow_singlequote ([$enable]) @@ -1205,7 +1206,7 @@ parentheses. The only thing it guarantees is that it starts decoding as soon as a syntactically valid JSON text has been seen. This means you need to set resource limits (e.g. C<max_size>) to ensure the -parser will stop parsing in the presence if syntax errors. +parser will stop parsing in the presence of syntax errors. The following methods implement this incremental parser. @@ -2414,9 +2415,9 @@ The F<cpanel_json_xs> command line utility for quick experiments. -L<JSON>, L<JSON::XS>, L<JSON::MaybeXS>, L<Mojo::JSON>, L<Mojo::JSON::MaybeXS>, -L<JSON::SL>, L<JSON::DWIW>, L<JSON::YAJL>, L<JSON::Any>, L<Test::JSON>, -L<Locale::Wolowitz>, +L<JSON::PP>, L<JSON>, L<JSON::XS>, L<JSON::MaybeXS>, L<Mojo::JSON>, +L<Mojo::JSON::MaybeXS>, L<JSON::SL>, L<JSON::DWIW>, L<JSON::YAJL>, +L<JSON::Any>, L<Test::JSON>, L<Locale::Wolowitz>, L<https://metacpan.org/search?q=JSON> L<https://tools.ietf.org/html/rfc7159> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/XS.xs new/Cpanel-JSON-XS-4.38/XS.xs --- old/Cpanel-JSON-XS-4.37/XS.xs 2023-07-04 12:27:51.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/XS.xs 2024-05-28 09:05:05.000000000 +0200 @@ -303,6 +303,10 @@ # endif #endif +#if (PERL_REVISION > 5) || (PERL_REVISION == 5 && PERL_VERSION >= 36) +# define PERL_HAVE_BOOLEANS +#endif + // i.e. "JSON" in big-endian #define JSON_MAGIC 0x4A534F4E @@ -1852,9 +1856,17 @@ if (!SvROK (sv)) { - if (UNLIKELY (sv == &PL_sv_yes)) + if (UNLIKELY (sv == &PL_sv_yes) +#ifdef PERL_HAVE_BOOLEANS + || (SvIsBOOL(sv) && SvTRUE(sv)) +#endif + ) encode_const_str (aTHX_ enc, "true", 4, 0); - else if (UNLIKELY (sv == &PL_sv_no)) + else if (UNLIKELY (sv == &PL_sv_no) +#ifdef PERL_HAVE_BOOLEANS + || (SvIsBOOL(sv) && !SvTRUE(sv)) +#endif + ) encode_const_str (aTHX_ enc, "false", 5, 0); else if (!SvOK (sv)) encode_const_str (aTHX_ enc, "false", 5, 0); @@ -1979,7 +1991,11 @@ } else { - if (UNLIKELY (sv == &PL_sv_yes || sv == &PL_sv_no)) type = JSON_TYPE_BOOL; + if (UNLIKELY (sv == &PL_sv_yes || sv == &PL_sv_no +#ifdef PERL_HAVE_BOOLEANS + || SvIsBOOL(sv) +#endif + )) type = JSON_TYPE_BOOL; else if (SvNOKp (sv)) type = JSON_TYPE_FLOAT; else if (SvIOKp (sv)) type = JSON_TYPE_INT; else if (SvPOKp (sv)) type = JSON_TYPE_STRING; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/t/20_unknown.t new/Cpanel-JSON-XS-4.38/t/20_unknown.t --- old/Cpanel-JSON-XS-4.37/t/20_unknown.t 2022-08-10 16:22:51.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/t/20_unknown.t 2024-05-28 09:05:05.000000000 +0200 @@ -7,6 +7,7 @@ or plan skip_all => 'JSON::PP 2.09 required for cross testing'; $ENV{PERL_JSON_BACKEND} = 'JSON::PP'; } +use constant HAVE_BOOLEANS => ($^V ge v5.36); plan tests => 32; use JSON::PP (); use Cpanel::JSON::XS (); @@ -64,9 +65,16 @@ is( $json->encode( {null => \"some"} ), '{"null":null}', 'js unknown' ); is( $json->encode( {null => \""} ), '{"null":null}', 'js unknown' ); -is( $json->encode( {true => !!1} ), '{"true":1}', 'js sv_yes' ); -is( $json->encode( {false => !!0} ), '{"false":""}', 'js sv_no' ); -is( $json->encode( {false => !!""} ), '{"false":""}', 'js sv_no' ); +if(HAVE_BOOLEANS) { + is( $json->encode( {true => !!1} ), '{"true":true}', 'js sv_yes' ); + is( $json->encode( {false => !!0} ), '{"false":false}', 'js sv_no' ); + is( $json->encode( {false => !!""} ), '{"false":false}', 'js sv_no' ); +} +else { + is( $json->encode( {true => !!1} ), '{"true":1}', 'js sv_yes' ); + is( $json->encode( {false => !!0} ), '{"false":""}', 'js sv_no' ); + is( $json->encode( {false => !!""} ), '{"false":""}', 'js sv_no' ); +} is( $json->encode( {true => \!!1} ), '{"true":true}', 'js \sv_yes' ); is( $json->encode( {false => \!!0} ), '{"false":null}', 'js \sv_no' ); is( $json->encode( {false => \!!""} ), '{"false":null}', 'js \sv_no' ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/t/25_boolean.t new/Cpanel-JSON-XS-4.38/t/25_boolean.t --- old/Cpanel-JSON-XS-4.37/t/25_boolean.t 2023-07-04 12:27:51.000000000 +0200 +++ new/Cpanel-JSON-XS-4.38/t/25_boolean.t 2024-05-28 09:05:05.000000000 +0200 @@ -1,5 +1,6 @@ use strict; -use Test::More tests => 42; +use constant HAVE_BOOLEANS => ($^V ge v5.36); +use Test::More tests => 42 + (HAVE_BOOLEANS ? 2 : 0); use Cpanel::JSON::XS (); use Config; @@ -125,3 +126,11 @@ $js = $unblessed_bool_cjson->decode($truefalse); ok eval { $js->[0] = "new value 0" }, "decoded 'true' is modifiable" or diag($@); ok eval { $js->[1] = "new value 1" }, "decoded 'false' is modifiable" or diag($@); + +if(HAVE_BOOLEANS) { + no if HAVE_BOOLEANS, warnings => "experimental::builtin"; + is($cjson->encode({t => builtin::true}), q({"t":true}), + 'true core booleans encode as boolean'); + is($cjson->encode({f => builtin::false}), q({"f":false}), + 'false core booleans encode as boolean'); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cpanel-JSON-XS-4.37/t/96_mojo.t new/Cpanel-JSON-XS-4.38/t/96_mojo.t --- old/Cpanel-JSON-XS-4.37/t/96_mojo.t 2020-10-27 18:39:10.000000000 +0100 +++ new/Cpanel-JSON-XS-4.38/t/96_mojo.t 2024-05-28 09:05:05.000000000 +0200 @@ -9,7 +9,7 @@ plan skip_all => "Mojo::JSON::decode_json required for testing interop"; exit 0; } - plan tests => 9; + plan tests => 12; } use Mojo::JSON (); @@ -35,18 +35,10 @@ my $mj = Mojo::JSON::encode_json( $yesno ); $js = $cjson->decode( $mj ); -# fragile -ok( $js->[0] eq '' or $js->[0] == 0 or !$js->[0], 'can decode Mojo false' ); -is( $js->[1], 1, 'can decode Mojo true' ); -# Note this is fragile. it depends on the internal representation of booleans. -# It can also be ['0', '1'] -if ($js->[0] eq '') { - is_deeply( $js, ['', 1], 'can decode Mojo booleans' ) - or diag( $mj, $js ); -} else { - TODO: { - local $TODO = 'fragile false => "0"'; - is_deeply( $js, ['', 1], 'can decode Mojo booleans' ) - or diag( $mj, $js ); - } -} +ok( !$js->[0], 'decoded Mojo false is false' ); +ok( $js->[0] == 0, 'decoded Mojo false is zero' ); +ok( $js->[0] eq "", 'decoded Mojo false is empty string' ); + +ok( $js->[1], 'decoded Mojo true is true' ); +ok( $js->[1] == 1, 'decoded Mojo true is one' ); +ok( $js->[1] eq "1", 'decoded Mojo true is "1" string' );
participants (1)
-
Source-Sync