| 1 | #!/usr/bin/env perl |
| 2 | use strictscip-perl cpan Catmandu 1.2025 strict/; |
| 3 | use warningsscip-perl cpan Catmandu 1.2025 warnings/; |
| 4 | use Test::Morescip-perl cpan Catmandu 1.2025 Test/More/; |
| 5 | use Test::Exceptionscip-perl cpan Catmandu 1.2025 Test/Exception/; |
| 6 | use Catmanduscip-perl cpan Catmandu 1.2025 Catmandu/; |
| 7 | use Capture::Tinyscip-perl cpan Catmandu 1.2025 Capture/Tiny/ ':all'; |
| 8 | use Catmandu::Utilscip-perl cpan Catmandu 1.2025 Catmandu/Util/ qw(:is); |
| 9 | |
| 10 | my $pkg; |
| 11 | |
| 12 | BEGIN { |
| 13 | $pkg = 'Catmandu::Fix::Bind::importer'; |
| 14 | use_okscip-perl cpan Catmandu 1.2025 main/use_ok(). $pkg; |
| 15 | } |
| 16 | require_okscip-perl cpan Catmandu 1.2025 main/require_ok(). $pkg; |
| 17 | |
| 18 | { |
| 19 | my ($stdout, $stderr, $exit) = capturescip-perl cpan Catmandu 1.2025 main/capture(). { |
| 20 | my $fixer = Catmandu->fixerscip-perl cpan Catmandu 1.2025 Catmandu/fixer().( |
| 21 | 'do importer(Mock,size:1) add_to_exporter(.,JSON) end'); |
| 22 | $fixscip-perl cpan Catmandu 1.2025 Catmandu/fix().er->fix({}); |
| 23 | }; |
| 24 | |
| 25 | isscip-perl cpan Catmandu 1.2025 main/is(). $stdout, qq|[{"n":0}]\n|, 'fixed ok'; |
| 26 | } |
| 27 | |
| 28 | { |
| 29 | my ($stdout, $stderr, $exit) = capturescip-perl cpan Catmandu 1.2025 main/capture(). { |
| 30 | my $fixer = Catmandu->fixerscip-perl cpan Catmandu 1.2025 Catmandu/fixer().('do importer(Mock,size:1) reject() end'); |
| 31 | $fixscip-perl cpan Catmandu 1.2025 Catmandu/fix().er->fix({}); |
| 32 | }; |
| 33 | |
| 34 | isscip-perl cpan Catmandu 1.2025 main/is(). $stdout, qq||, 'fixed ok'; |
| 35 | } |
| 36 | |
| 37 | { |
| 38 | my ($stdout, $stderr, $exit) = capturescip-perl cpan Catmandu 1.2025 main/capture(). { |
| 39 | my $fixer = Catmandu->fixerscip-perl cpan Catmandu 1.2025 Catmandu/fixer().( |
| 40 | 'do importer(Mock,size:1) select exists(n) end'); |
| 41 | $fixscip-perl cpan Catmandu 1.2025 Catmandu/fix().er->fix({}); |
| 42 | }; |
| 43 | |
| 44 | isscip-perl cpan Catmandu 1.2025 main/is(). $stdout, qq||, 'fixed ok'; |
| 45 | } |
| 46 | |
| 47 | done_testing; |