File: Catmandu-Fix-Bind-importer.t

package info (click to toggle)
libcatmandu-perl 1.0304-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,756 kB
  • ctags: 695
  • sloc: perl: 13,756; makefile: 34
file content (47 lines) | stat: -rw-r--r-- 910 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Exception;
use Catmandu;
use Capture::Tiny ':all';
use Catmandu::Util qw(:is);

my $pkg;

BEGIN {
    $pkg = 'Catmandu::Fix::Bind::importer';
    use_ok $pkg;
}
require_ok $pkg;

{
    my ($stdout, $stderr, $exit) = capture {
        my $fixer = Catmandu->fixer(
            'do importer(Mock,size:1) add_to_exporter(.,JSON) end');
        $fixer->fix({});
    };

    is $stdout, qq|[{"n":0}]\n|, 'fixed ok';
}

{
    my ($stdout, $stderr, $exit) = capture {
        my $fixer = Catmandu->fixer('do importer(Mock,size:1) reject() end');
        $fixer->fix({});
    };

    is $stdout, qq||, 'fixed ok';
}

{
    my ($stdout, $stderr, $exit) = capture {
        my $fixer = Catmandu->fixer(
            'do importer(Mock,size:1) select exists(n) end');
        $fixer->fix({});
    };

    is $stdout, qq||, 'fixed ok';
}

done_testing;