Permalink
Browse files

.join now defaults to ''

git-svn-id: http://svn.pugscode.org/pugs@26130 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent ac0e981 commit 49d046fa1df08db9ec46112cbdcf458d9ca1109f lwall committed Apr 8, 2009
@@ -13,11 +13,11 @@ plan 8;
is +%h.elems, 2, 'Inititalization worked';
lives_ok { %h<c> = 0 }, 'can set an item to 0';
is %h.elems, 1, '... and an item is gone';
- is %h.keys.join(''), 'a', '... and the right one is gone';
+ is %h.keys.join, 'a', '... and the right one is gone';
%h<c>++;
- is %h.keys.sort.join(''), 'ac', '++ on an item reinstates it';
+ is %h.keys.sort.join, 'ac', '++ on an item reinstates it';
%h<c>++;
- is %h.keys.sort.join(''), 'ac', '++ on an existing item does nothing';
+ is %h.keys.sort.join, 'ac', '++ on an existing item does nothing';
%h<a>--;
is ~%h.keys, 'c', '-- removes items';
%h<b>--;
View
@@ -73,7 +73,7 @@ is (1..2 Z <a b c>).join('|'), '1|a|2|b', 'Ranges and infix:<Z>';
is (<c b a> Z 1..5).join('|'), 'c|1|b|2|a|3', 'Ranges and infix:<Z>';
# two ranges
-is (1..6 Z 'a' .. 'c').join(''), '1a2b3c', 'Ranges and infix:<Z>';
+is (1..6 Z 'a' .. 'c').join, '1a2b3c', 'Ranges and infix:<Z>';
{
@@ -14,7 +14,7 @@ for 1, 2 {
for 1, 2 {
my @inside;
for 1 .. 3 { push @inside, $_; }
- is(@inside.join(""), "123", "lexical array properly initialized, round $_");
+ is(@inside.join, "123", "lexical array properly initialized, round $_");
}
# Explicit $_
@@ -27,7 +27,7 @@ for 1, 2 {
for 1, 2 {
my @inside;
for 1 .. 3 -> $_ { push @inside, $_; }
- is(@inside.join(""), "123", "lexical array properly initialized, round $_, explicit \$_");
+ is(@inside.join, "123", "lexical array properly initialized, round $_, explicit \$_");
}
# Explicit $_
@@ -40,7 +40,7 @@ for 1, 2 -> $_ {
for 1, 2 -> $_ {
my @inside;
for 1 .. 3 -> $_ { push @inside, $_; }
- is(@inside.join(""), "123", "lexical array properly initialized, round $_, two explicit \$_s");
+ is(@inside.join, "123", "lexical array properly initialized, round $_, two explicit \$_s");
}
{
@@ -113,11 +113,11 @@ sub countdown_mod_named ($num) {
}
#?rakudo 8 skip 'argument passing'
-is( countup_nomod_named(5).join(""), "012345", "recursive count up: named param, no modified value");
-is(countdown_nomod_named(5).join(""), "543210", "recursive count down: named param, no modified value");
-is( countup_nomod_unnamed(5).join(""), "012345", "recursive count up: unnamed param, no modified value");
-is(countdown_nomod_unnamed(5).join(""), "543210", "recursive count down: unnamed param, no modified value");
-is( countup_mod_named(5).join(""), "012345", "recursive count up: named param, modified value");
-is(countdown_mod_named(5).join(""), "543210", "recursive count down: named param, modified value");
-is( countup_mod_unnamed(5).join(""), "012345", "recursive count up: unnamed param, modified value");
-is(countdown_mod_unnamed(5).join(""), "543210", "recursive count down: unnamed param, modified value");
+is( countup_nomod_named(5).join, "012345", "recursive count up: named param, no modified value");
+is(countdown_nomod_named(5).join, "543210", "recursive count down: named param, no modified value");
+is( countup_nomod_unnamed(5).join, "012345", "recursive count up: unnamed param, no modified value");
+is(countdown_nomod_unnamed(5).join, "543210", "recursive count down: unnamed param, no modified value");
+is( countup_mod_named(5).join, "012345", "recursive count up: named param, modified value");
+is(countdown_mod_named(5).join, "543210", "recursive count down: named param, modified value");
+is( countup_mod_unnamed(5).join, "012345", "recursive count up: unnamed param, modified value");
+is(countdown_mod_unnamed(5).join, "543210", "recursive count down: unnamed param, modified value");
@@ -149,7 +149,7 @@ class PairTest {
{
class MyArray {
has @.elems handles "join";
- method concat handles <chars bytes graphs codes> { .join("") }
+ method concat handles <chars bytes graphs codes> { .join }
}
ok MyArray.new, "class with attribute and return value delegation";
View
@@ -25,8 +25,8 @@ is($joined3, "a|b|c", 'join("|", 1, 2, 3) works');
my $joined4 = join("|", [ "a", "b", "c" ]);
is($joined4, "a b c", 'join("|", []) should not join anything');
-# join() without a separator (defaults to ' ', per S29)
-is(<a b c>.join, 'a b c', 'join() separator defaults to " ".');
+# join() without a separator (defaults to '', per S32)
+is(<a b c>.join, 'abc', 'join() separator defaults to "".');
# join() with $sep as a variable
View
@@ -164,17 +164,17 @@ plan 28;
{
my %map = (p => 1, e => 2, r => 3, l => 4);
- is <r e p l>.sort({ %map{$_} }).join(''), 'perl',
+ is <r e p l>.sort({ %map{$_} }).join, 'perl',
'can sort with automated Schwartzian Transform';
my @s = %map.sort: { .value };
isa_ok(@s[0], Pair, '%hash.sort returns a List of Pairs');
- is (@s.map: { .key }).join(''), 'perl', 'sort with unary sub'
+ is (@s.map: { .key }).join, 'perl', 'sort with unary sub'
}
{
- is (<P e r l 6>.sort: { 0; }).join(''), 'Perl6',
+ is (<P e r l 6>.sort: { 0; }).join, 'Perl6',
'sort with arity 0 closure is stable';
my @a = ([5, 4], [5, 5], [5, 6], [0, 0], [1, 2], [1, 3], [0, 1], [5, 7]);
View
@@ -50,7 +50,7 @@ is($x, "HeLLo\\ World\\-72_1", 'quotemeta uses $_ as default');
if (%Config<ebcdic> eq 'define') {
- $_ = (129 .. 233).map({ chr($_); }).join('');
+ $_ = (129 .. 233).map({ chr($_); }).join;
is($_.chars, 96, "quotemeta starting string");
# 105 characters - 52 letters = 53 backslashes
@@ -61,7 +61,7 @@ if (%Config<ebcdic> eq 'define') {
is($_.split('').grep({ $_ eq "\x5c" }).elems, 54, "count backslashes");
}
else {
- $_ = (0 .. 255).map({ chr($_); }).join('');
+ $_ = (0 .. 255).map({ chr($_); }).join;
is($_.chars, 256, "quotemeta starting string");
# Original test in Perl 5.9.3:

0 comments on commit 49d046f

Please sign in to comment.