Skip to content

Commit

Permalink
Update tests to reflect empty leading and trailing elements
Browse files Browse the repository at this point in the history
See RT#112868
  • Loading branch information
perlpilot committed Jul 18, 2015
1 parent 4f22909 commit 256d6a9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
6 changes: 2 additions & 4 deletions S32-str/split-simple.t
Expand Up @@ -57,17 +57,16 @@ split_test(
'Limit larger than number of split values doesn\'t return extranuous elements'
);

#?niecza skip 'niecza has empty value at beginning of list'
{
split_test
'abcdefg'.split('', 3),
<a b cdefg>,
('', 'a', 'bcdefg'),
'split into characters respects limit (1)';

# catch possible off-by-one errors
split_test
'abc'.split('', 3),
<a b c>,
( '', 'a', 'bc'),
'split into characters respects limit (2)';
}

Expand Down Expand Up @@ -107,7 +106,6 @@ ok (split('', '')).elems == 0, q{''.split('') returns empty list};
{
my $rt112868 = 'splitting on empty';
ok $rt112868.split('').elems > 0, q<.split('') does something>;
#?rakudo todo 'RT #112868'
is $rt112868.split(''), $rt112868.split(/''/),
q<.split('') does the same thing as .split(/''/) (RT #112868)>;
}
Expand Down
9 changes: 4 additions & 5 deletions S32-str/split.t
Expand Up @@ -7,16 +7,15 @@ use Test;
plan 53;

# split on empty string
#?niecza todo "split on empty string has leading empty elements"
{
is split("", "forty-two").join(','), 'f,o,r,t,y,-,t,w,o',
is split("", "forty-two").join(','), ',f,o,r,t,y,-,t,w,o,',
q{split "", Str};
is "forty-two".split("").join(','), 'f,o,r,t,y,-,t,w,o',
is "forty-two".split("").join(','), ',f,o,r,t,y,-,t,w,o,',
q{Str.split: ""};

is split("", "forty-two", 3).join(','), 'f,o,rty-two',
is split("", "forty-two", 3).join(','), ',f,orty-two',
q{split "", Str};
is "forty-two".split("",3).join(','), 'f,o,rty-two',
is "forty-two".split("",3).join(','), ',f,orty-two',
q{Str.split: ""};
}

Expand Down
2 changes: 1 addition & 1 deletion integration/advent2011-day23.t
Expand Up @@ -68,7 +68,7 @@ for 'I must go down to the seas again' {
my @chars;

@chars = $word.split('');
is-deeply @chars, [<C a m e l i a>], q<@chars = $word.split('');>;
is-deeply @chars, ['', <C a m e l i a>, ''], q<@chars = $word.split('');>;

@chars = $word.comb;
is-deeply @chars, [<C a m e l i a>], '@chars = $word.comb;';
Expand Down
4 changes: 2 additions & 2 deletions integration/real-strings.t
Expand Up @@ -33,8 +33,8 @@ throws-like { for "a b c".split(/\s/) -> $foo { $foo = $foo; } },
#?niecza todo 'Suspect test'
{
my @foo = 'AB'.split('');
@foo[0]++;
is ~@foo, 'B B', 'Str.split(Str) works with postfix:<++>';
@foo[1]++;
is ~@foo, ' B B ', 'Str.split(Str) works with postfix:<++>';
}

ok 1.Str ~~ / ^ 1 $ /, 'RT 66366; 1.Str is a "good" Str';
Expand Down

0 comments on commit 256d6a9

Please sign in to comment.