| 1 | use strict; |
| 2 | use warnings; |
| 3 | use Test::More tests => 7; |
| 4 | use autobox::Core; |
| 5 | |
| 6 | is "Hello, World\n"->uc, "HELLO, WORLD\n"; |
| 7 | |
| 8 | my @list = (1, 5, 9, 2, 0, 4, 2, 1); |
| 9 | is_deeply [@list->sort->reverse], [9,5,4,2,2,1,1,0]; |
| 10 | |
| 11 | # works with references too! |
| 12 | my $list = [1, 5, 9, 2, 0, 4, 2, 1]; |
| 13 | is_deeply [$list->sort->reverse], [9,5,4,2,2,1,1,0]; |
| 14 | |
| 15 | my %hash = ( |
| 16 | grass => 'green', |
| 17 | apple => 'red', |
| 18 | sky => 'blue', |
| 19 | ); |
| 20 | |
| 21 | is [10, 20, 30, 40, 50]->pop, 50; |
| 22 | is [10, 20, 30, 40, 50]->shift, 10; |
| 23 | |
| 24 | my $lala = "Lalalalala\n"; |
| 25 | is "chomp: "->concat($lala->chomp, " ", $lala), "chomp: 1 Lalalalala"; |
| 26 | |
| 27 | my $hashref = { foo => 10, bar => 20, baz => 30, qux => 40 }; |
| 28 | |
| 29 | is $hashref->keys->sort->join(' '), "bar baz foo qux"; |
| 30 |