Skip to content
Browse files

Add default value for into RPA.join to follow Perl6 setting closely

  • Loading branch information...
1 parent b1a8289 commit e657b280d6434401adb6c1f881e209d91caf0133 @bacek bacek committed Jan 17, 2011
Showing with 4 additions and 2 deletions.
  1. +1 −1 src/setting/ResizablePMCArray.pm
  2. +3 −1 t/setting/01-resizablepmcarray.t
View
2 src/setting/ResizablePMCArray.pm
@@ -31,7 +31,7 @@ module ResizablePMCArray {
Return all elements joined by $sep.
=end item
- method join ($separator) {
+ method join ($separator = '') {
pir::join($separator, self);
}
View
4 t/setting/01-resizablepmcarray.t
@@ -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');

0 comments on commit e657b28

Please sign in to comment.
Something went wrong with that request. Please try again.