1Test::Deep::JSON(3pm) User Contributed Perl DocumentationTest::Deep::JSON(3pm)
2
3
4
6 Test::Deep::JSON - Compare JSON with Test::Deep
7
9 use Test::Deep;
10 use Test::Deep::JSON;
11
12 cmp_deeply {
13 foo => 'bar',
14 payload => '{"a":1}',
15 }, {
16 foo => 'bar',
17 payload => json({ a => ignore() }),
18 };
19
21 Test::Deep::JSON provides the "json($expected)" function to expect that
22 target can be parsed as a JSON string and matches (by "cmp_deeply")
23 with $expected.
24
26 json($expected)
27 Exported by default.
28
29 $expected can be anything that "Test::Deep" recognizes.
30
31 This parses the data as a JSON string, and compares the parsed
32 object and $expected by "Test::Deep" functionality.
33
34 Fails if the data cannot be parsed as a JSON string.
35
37 motemen <motemen@gmail.com>
38
40 Test::Deep
41
43 This library is free software; you can redistribute it and/or modify it
44 under the same terms as Perl itself.
45
46
47
48perl v5.30.1 2020-01-30 Test::Deep::JSON(3pm)