1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
# NAME
Test::Deep::JSON - Compare JSON with Test::Deep
# SYNOPSIS
use Test::Deep;
use Test::Deep::JSON;
cmp_deeply {
foo => 'bar',
payload => '{"a":1}',
}, {
foo => 'bar',
payload => json({ a => ignore() }),
};
# 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.
# AUTHOR
motemen <motemen@gmail.com>
# SEE ALSO
[Test::Deep](https://metacpan.org/pod/Test::Deep)
# LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
|