Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add default value for into RPA.join to follow Perl6 setting closely
  • Loading branch information
bacek committed Jan 16, 2011
1 parent b1a8289 commit e657b28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/setting/ResizablePMCArray.pm
Expand Up @@ -31,7 +31,7 @@ module ResizablePMCArray {
Return all elements joined by $sep.
=end item

method join ($separator) {
method join ($separator = '') {
pir::join($separator, self);
}

Expand Down
4 changes: 3 additions & 1 deletion t/setting/01-resizablepmcarray.t
Expand Up @@ -5,14 +5,16 @@ pir::load_bytecode('nqp-setting.pbc');
my @array := <0 1 2>;
my @reversed := @array.reverse();

plan(10);
plan(11);

ok( @reversed[0] == 2, 'First element correct');
ok( @reversed[1] == 1, 'Second element correct');
ok( @reversed[2] == 0, 'Third element correct');

my $join := @array.join('|');
ok( $join eq '0|1|2', 'Join elements');
$join := @array.join();
ok( $join eq '012', 'Join with default separator');

ok( join(':', 'foo', 'bar', 'baz') eq 'foo:bar:baz', 'Join as standalone function');

Expand Down

0 comments on commit e657b28

Please sign in to comment.