6 use Test::More tests => 20;
10 use_ok('Moose::Autobox');
15 my $VAR1; # for eval of dumps
17 is('Hello World'->lc, 'hello world', '... $str->lc');
18 is('Hello World'->uc, 'HELLO WORLD', '... $str->uc');
20 is('foo'->ucfirst, 'Foo', '... $str->ucfirst');
21 is('Foo'->lcfirst, 'foo', '... $str->lcfirst');
23 dies_ok { ('Hello')->chop } '... cannot modify a read-only';
25 my $greeting = 'Hello';
26 is($greeting->chop, 'o', '... got the chopped off portion of the string');
27 is($greeting, 'Hell', '... and are left with the rest of the string');
30 dies_ok { "Hello\n"->chomp } '... cannot modify a read-only';
32 my $greeting = "Hello\n";
33 is($greeting->chomp, '1', '... got the chopped off portion of the string');
34 is($greeting, 'Hello', '... and are left with the rest of the string');
37 is('reverse'->reverse, 'esrever', '... got the string reversal');
38 is('length'->length, 6, '... got the string length');
40 is('Hello World'->index('World'), 6, '... got the correct index');
42 is('Hello World, Hello'->index('Hello'), 0, '... got the correct index');
44 is('Hello World, Hello'->index('Hello', 6), 13, '... got the correct index');
46 is('Hello World, Hello'->rindex('Hello'), 13, '... got the correct right index');
48 is('Hello World, Hello'->rindex('Hello', 6), 0, '... got the correct right index');
50 eval 'Hello World, Hello'->dump;
51 is($VAR1, 'Hello World, Hello' , '... eval of &dump works');
53 eval 'Hello World, Hello'->perl;
54 is($VAR1, 'Hello World, Hello' , '... eval of &perl works');