File: Catmandu-Fix-perlcode.t

package info (click to toggle)
libcatmandu-perl 1.2024-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,552 kB
  • sloc: perl: 17,037; makefile: 24; sh: 1
file content (20 lines) | stat: -rw-r--r-- 534 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use strict;
use warnings;
use Test::More;
use Catmandu::Fix;
use Catmandu::Fix::perlcode;

foreach my $i (1 .. 2) {    # also tests caching
    my $fixer = Catmandu::Fix->new(fixes => ['perlcode(./t/script.pl)']);
    my $data  = {};
    $fixer->fix($data);
    is_deeply $data, {answer => 42}, 'perlcode fix';
}

{
    my $fixer = Catmandu::Fix->new(fixes => ['perlcode(./t/script.pl)']);
    is_deeply $fixer->fix([map {+{answer => $_}} 1 .. 3]),
        [{answer => 1}, {answer => 3}], 'perlcode fix with reject';
}

done_testing;