File: sort.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 (19 lines) | stat: -rw-r--r-- 369 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
use Test::More qw(no_plan);
use strict;
use warnings;

use autobox::Core;

my @array = qw(foo bar baz);

my @returned = @array->sort;

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

@returned = @array->sort(sub { $_[1] cmp $_[0] });

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

my $arrayref = @array->sort;

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