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