| 1 | use Test::More qw(no_plan); |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | |
| 5 | use autobox::Core; |
| 6 | |
| 7 | my @array = qw(foo bar baz); |
| 8 | |
| 9 | my @returned = @array->sort; |
| 10 | |
| 11 | is_deeply \@returned, [qw(bar baz foo)]; |
| 12 | |
| 13 | @returned = @array->sort(sub { $_[1] cmp $_[0] }); |
| 14 | |
| 15 | is_deeply \@returned, [qw(foo baz bar)]; |
| 16 | |
| 17 | my $arrayref = @array->sort; |
| 18 | |
| 19 | is ref $arrayref, "ARRAY", "Returns an arrayref in scalar context"; |