logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Test::Deep::JSON - Compare JSON with Test::Deep

Author

       motemen <motemen@gmail.com>

Description

       Test::Deep::JSON provides the "json($expected)" function to expect that target can be parsed as a JSON
       string and matches (by "cmp_deeply") with $expected.

Functions

       json($expected)
           Exported by default.

           $expected can be anything that "Test::Deep" recognizes.

           This  parses  the data as a JSON string, and compares the parsed object and $expected by "Test::Deep"
           functionality.

           Fails if the data cannot be parsed as a JSON string.

License

       This library is free software; you can redistribute it and/or modify it under  the  same  terms  as  Perl
       itself.

perl v5.36.0                                       2022-12-12                              Test::Deep::JSON(3pm)

Name

       Test::Deep::JSON - Compare JSON with Test::Deep

See Also

       Test::Deep

Synopsis

         use Test::Deep;
         use Test::Deep::JSON;

         cmp_deeply {
             foo => 'bar',
             payload => '{"a":1}',
         }, {
             foo => 'bar',
             payload => json({ a => ignore() }),
         };

See Also