use v6;
use Test;

# L<S32::Str/Str/"=item p5chomp">

plan 6;

my $string = "abc";

is(p5chomp($string), 0, 'p5chomp leaves strings untouched that don\'t end in \n');
is($string, "abc", 'p5chomp did not change "abc"');

$string = "abc\n\n";

is(p5chomp($string), 1, 'p5chomp removes one \n even if the string ends in \n\n');
is($string, "abc\n", 'p5chomp removed one \n');

my @s = "abc", "def\n", "gh\n";
is(p5chomp(@s), 2, 'p5chomp on lists returns the number of removed \ns');
is(@s, <abc def gh>, 'p5chomp on lists works');

# vim: ft=perl6

use v6;
use Test;

# L<S32::Str/Str/"=item p5chomp">

plan 6;

my $string = "abc";

is(p5chomp($string), 0, 'p5chomp leaves strings untouched that don\'t end in \n');
is($string, "abc", 'p5chomp did not change "abc"');

$string = "abc\n\n";

is(p5chomp($string), 1, 'p5chomp removes one \n even if the string ends in \n\n');
is($string, "abc\n", 'p5chomp removed one \n');

my @s = "abc", "def\n", "gh\n";
is(p5chomp(@s), 2, 'p5chomp on lists returns the number of removed \ns');
is(@s, [<abc def gh>], 'p5chomp on lists works');

# vim: ft=perl6

Put list inside [] to do array comparison
Put list inside [] to do array comparison



git-svn-id: 53605643c415f7495558be95614cf14171f1db78@29954 c213334d-75ef-0310-aa23-eaa082d1ae64
