| 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use Test::More tests => 4; |
| 5 | use autobox::Core; |
| 6 | |
| 7 | my @array = qw(foo bar baz gorch); |
| 8 | |
| 9 | ok @array->range(0,1); |
| 10 | is_deeply [@array->range(0,1)], ['foo', 'bar']; |
| 11 | |
| 12 | my @slice = @array->range(0,2); |
| 13 | |
| 14 | is scalar @slice, 3, "Returns an array in list context"; |
| 15 | |
| 16 | my $slice = @array->range(0,2); |
| 17 | |
| 18 | is ref $slice, 'ARRAY', "Returns an arrayref in scalar context"; |