Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
less magic
  • Loading branch information
kraih committed Aug 23, 2011
1 parent 7a37c3d commit f7193f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/ByteStream.pm
Expand Up @@ -164,8 +164,8 @@ sub sha1_sum {
sub size { length shift->{bytestream} }

sub split {
my ($self, $p) = @_;
Mojo::Collection->new(split defined $p ? $p : '', $self->{bytestream});
my ($self, $pattern) = @_;
Mojo::Collection->new(split $pattern, $self->{bytestream});
}

sub to_string { shift->{bytestream} }
Expand Down
4 changes: 2 additions & 2 deletions t/mojo/bytestream.t
Expand Up @@ -363,8 +363,8 @@ is "$stream", "la\nla\nla", 'right trimmed result';
$stream = b('1,2,3,4,5');
is_deeply [$stream->split(',')->each], [1, 2, 3, 4, 5], 'right elements';
is_deeply [$stream->split(qr/,/)->each], [1, 2, 3, 4, 5], 'right elements';
is_deeply [b('54321')->split->each], [5, 4, 3, 2, 1], 'right elements';
is_deeply [b('')->split->each], [], 'no elements';
is_deeply [b('54321')->split('')->each], [5, 4, 3, 2, 1], 'right elements';
is_deeply [b('')->split('')->each], [], 'no elements';
is_deeply [b('')->split(',')->each], [], 'no elements';
is_deeply [b('')->split(qr/,/)->each], [], 'no elements';

Expand Down

0 comments on commit f7193f7

Please sign in to comment.