File: chop.t

package info (click to toggle)
libautobox-core-perl 1.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 328 kB
  • ctags: 161
  • sloc: perl: 567; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 438 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use Test::More qw(no_plan);
use strict;
use warnings;

use autobox::Core;

my $string = "This is a string";

my $char = $string->chop;

is $string, "This is a strin", "Chop modifies the string";
is $char, "g", "... and returns the last character";

TODO: {

    todo_skip "Chop should work on lists too", 2;

    my @list = qw(foo bar baz);

    my $char = @list->chop;

    is $char, 'z';

    is_deeply \@list, [ 'fo', 'ba', 'ba' ];
}