| 1 | use Test::More qw(no_plan); |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | |
| 5 | use autobox::Core; |
| 6 | |
| 7 | # https://github.com/schwern/perl5i/issues/182 |
| 8 | my $scalar = 'foo'; |
| 9 | my($reverse) = $scalar->reverse; # list context |
| 10 | is $reverse, 'oof', 'reverse in list context reverses the scalar'; |
| 11 | is scalar $scalar->reverse, 'oof', 'reverse in scalar context reverses the scalar'; |
| 12 | |
| 13 | is "Hello"->reverse, "olleH"; |
| 14 | |
| 15 | my @list = qw(foo bar baz); |
| 16 | |
| 17 | is_deeply [@list->reverse], [qw(baz bar foo)]; |
| 18 | |
| 19 | my $arrayref = @list->reverse; |
| 20 | |
| 21 | is ref $arrayref, "ARRAY", "returns an arrayref in scalar context"; |
| 22 |