File: map.t

package info (click to toggle)
libperl5i-perl 2.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 996 kB
  • ctags: 343
  • sloc: perl: 6,259; makefile: 5
file content (12 lines) | stat: -rw-r--r-- 348 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl

use perl5i::latest;
use Test::More;

my @array = (4,5,6);
is_deeply [@array->map(sub { $_[0] + 1 })],      [5,6,7], "map in list context";
is_deeply scalar @array->map(sub { $_[0] + 1 }), [5,6,7], "map in scalar context";

is_deeply [@array->map( func($item) { $item + 1 } )], [5,6,7], "map with named arguments";

done_testing();