stop using Module::Install
[gitmo/Moose-Autobox.git] / t / 004_list_compressions.t
CommitLineData
252ab1a2 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
171cd606 6use Test::More tests => 4;
252ab1a2 7
7dad2765 8use Moose::Autobox;
252ab1a2 9
10is_deeply(
11[ 1 .. 5 ]->map(sub { $_ * $_ }),
12[ 1, 4, 9, 16, 25 ],
13'... got the expected return values');
14
15is_deeply(
16[ 1 .. 5 ]->map(sub { $_ * $_ })->do(sub { $_->zip($_) }),
17[ [1, 1], [4, 4], [9, 9], [16, 16], [25, 25] ],
6cf5bcf2 18'... got the expected return values');
19
20is( # sprintf an array ...
21[ 1 .. 5 ]->sprintf("%d -> %d -> %d"),
22'1 -> 2 -> 3',
23'... got the sprintf-ed values');
24
25is( # sprintf an array ...
26[ 1 .. 5 ]->do(sub {
27 $_->sprintf(
28 $_->keys
29 ->map(sub { '%d (' . $_ . ')' })
30 ->join(' -> '))
31}),
32'1 (0) -> 2 (1) -> 3 (2) -> 4 (3) -> 5 (4)',
33'... got a more elaboratly sprintf-ed values');
34