File: unshift.t

package info (click to toggle)
libautobox-core-perl 1.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 328 kB
  • ctags: 161
  • sloc: perl: 567; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 421 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use Test::More qw(no_plan);
use strict;
use warnings;

use autobox::Core;

my @array = qw(foo bar);

my @returned = @array->unshift('baz');

is_deeply \@array,    [qw(baz foo bar)];
is_deeply \@returned, [qw(baz foo bar)];

my $arrayref = @array->unshift('baz');

is ref $arrayref, 'ARRAY', "Returns arrayref in scalar context";

my $array = [qw(foo bar)];

$array->unshift('baz');

is_deeply $array, [qw(baz foo bar)];