perl で返ってきた json とかの値が 配列で sort されてて長さが hogehoge で
みたいなのを test::deep で書きたい感じの場合は
cmp_deeply( $res->content, json({ array => is_array_ref && cond { $_->[0]->id == .... && $_->[-1]->id == .... } && cond { scalar @$_ == ... }, }) ):
みたいな感じで書けなくはないですが、分かりづらいので複数に分けたほうが良さそうけど、ぱっと書いちゃうみたいな時は便利といえば便利だったりする。
出てきたモジュール
- test::deep
- test::deep::matcher
- test::deep::json
- test::deep::cond