| 1 | use Test::More qw(no_plan); |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | |
| 5 | use autobox::Core; |
| 6 | |
| 7 | my $string = "This is a string"; |
| 8 | |
| 9 | my $char = $string->chop; |
| 10 | |
| 11 | is $string, "This is a strin", "Chop modifies the string"; |
| 12 | is $char, "g", "... and returns the last character"; |
| 13 | |
| 14 | TODO: { |
| 15 | |
| 16 | todo_skip "Chop should work on lists too", 2; |
| 17 | |
| 18 | my @list = qw(foo bar baz); |
| 19 | |
| 20 | my $char = @list->chop; |
| 21 | |
| 22 | is $char, 'z'; |
| 23 | |
| 24 | is_deeply \@list, [ 'fo', 'ba', 'ba' ]; |
| 25 | } |
| 26 |