Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit e657b280d6434401adb6c1f881e209d91caf0133 1 parent b1a8289
@bacek bacek authored
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,7 +5,7 @@ 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');
@@ -13,6 +13,8 @@ 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');
Please sign in to comment.
Something went wrong with that request. Please try again.