| 1 | #!/usr/bin/env perl |
| 2 | |
| 3 | use strictscip-perl cpan Catmandu 1.2025 strict/; |
| 4 | use warningsscip-perl cpan Catmandu 1.2025 warnings/; |
| 5 | use Test::Morescip-perl cpan Catmandu 1.2025 Test/More/; |
| 6 | use Test::Exceptionscip-perl cpan Catmandu 1.2025 Test/Exception/; |
| 7 | |
| 8 | my $pkg; |
| 9 | |
| 10 | BEGIN { |
| 11 | $pkg = 'Catmandu::Fix::disassoc'; |
| 12 | use_okscip-perl cpan Catmandu 1.2025 main/use_ok(). $pkg; |
| 13 | } |
| 14 | |
| 15 | is_deeplyscip-perl cpan Catmandu 1.2025 main/is_deeply(). $pkg->newscip-perl cpan Catmandu 1.2025 main/new().('fields', 'pairs', 'key', 'val') |
| 16 | ->fixscip-perl cpan Catmandu 1.2025 main/fix().({fields => {subject => 'Perl', year => 2009}}), |
| 17 | { |
| 18 | fields => {subject => 'Perl', year => 2009}, |
| 19 | pairs => [{key => 'subject', val => 'Perl'}, {key => 'year', val => 2009}] |
| 20 | }; |
| 21 | |
| 22 | is_deeplyscip-perl cpan Catmandu 1.2025 main/is_deeply(). $pkg->newscip-perl cpan Catmandu 1.2025 main/new().('fields', 'my.deep.field', 'key', 'val') |
| 23 | ->fixscip-perl cpan Catmandu 1.2025 main/fix().({fields => {subject => 'Perl', year => 2009}}), |
| 24 | { |
| 25 | fields => {subject => 'Perl', year => 2009}, |
| 26 | my => { |
| 27 | deep => { |
| 28 | field => [ |
| 29 | {key => 'subject', val => 'Perl'}, |
| 30 | {key => 'year', val => 2009} |
| 31 | ] |
| 32 | } |
| 33 | } |
| 34 | }; |
| 35 | |
| 36 | is_deeplyscip-perl cpan Catmandu 1.2025 main/is_deeply(). $pkg->newscip-perl cpan Catmandu 1.2025 main/new().('fields', '', 'key', 'val') |
| 37 | ->fixscip-perl cpan Catmandu 1.2025 main/fix().({fields => {subject => 'Perl', year => 2009}}), |
| 38 | {fields => {subject => 'Perl', year => 2009}}, "can't replace root"; |
| 39 | |
| 40 | done_testing; |