This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Brendan Byrd is now a perl AUTHOR
[perl5.git] / ext / arybase / t / aeach.t
1 use warnings; no warnings 'deprecated';
2 use strict;
3
4 BEGIN {
5         if("$]" < 5.011) {
6                 require Test::More;
7                 Test::More::plan(skip_all => "no array each on this Perl");
8         }
9 }
10
11 use Test::More tests => 2;
12
13 our @activity;
14
15 $[ = 3;
16
17 our @t0 = qw(a b c);
18 @activity = ();
19 foreach(0..5) {
20         push @activity, [ each(@t0) ];
21 }
22 is_deeply \@activity, [
23         [ 3, "a" ],
24         [ 4, "b" ],
25         [ 5, "c" ],
26         [],
27         [ 3, "a" ],
28         [ 4, "b" ],
29 ];
30
31 our @t1 = qw(a b c);
32 @activity = ();
33 foreach(0..5) {
34         push @activity, [ scalar each(@t1) ];
35 }
36 is_deeply \@activity, [
37         [ 3 ],
38         [ 4 ],
39         [ 5 ],
40         [ undef ],
41         [ 3 ],
42         [ 4 ],
43 ];
44
45 1;