File: tail.t

package info (click to toggle)
libautobox-core-perl 1.21-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 400 kB
  • sloc: perl: 647; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 7;
use autobox::Core;

my @array = qw(foo bar baz);

ok @array->tail;
is_deeply [@array->tail], ['bar', 'baz'];

is_deeply [@array->tail(1)], ['baz'];
is_deeply [@array->tail(2)], ['bar', 'baz'];
is_deeply [@array->tail(3)], ['foo', 'bar', 'baz'];

my @tail = @array->tail;
is scalar @tail, 2, "Returns a list in list context";

my $tail = @array->tail;
is ref $tail, 'ARRAY', "Returns an arrayref in scalar context";