Skip to content

Commit

Permalink
Add some more Str.lines tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Sep 9, 2014
1 parent c888e81 commit 2dd48dc
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions S32-str/lines.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@ use Test;
use lib 't/spec/packages';
use Test::Util;

plan 5;
plan 14;

is "a\nb\n\nc".lines.join('|'), 'a|b||c', 'LF .lines without trailing';
is "a\nb\n\nc\n".lines.join('|'), 'a|b||c', 'LF .lines with trailing';
is "a\nb\n\nc\n".lines(2).join('|'), 'a|b', 'LF .lines with limit';

is "a\rb\r\rc".lines.join('|'), 'a|b||c', 'CR .lines without trailing';
is "a\rb\r\rc\r".lines.join('|'), 'a|b||c', 'CR .lines with trailing';
is "a\rb\r\rc\r".lines(2).join('|'), 'a|b', 'CR .lines with limit';

is "a\r\nb\r\n\r\nc".lines.join('|'), 'a|b||c',
'CRLF .lines without trailing';
is "a\r\nb\r\n\r\nc\r\n".lines.join('|'), 'a|b||c',
'CRLF .lines with trailing';
is "a\r\nb\r\n\r\nc\r\n".lines(2).join('|'), 'a|b',
'CRLF .lines with limit';

#?rakudo 3 todo 'mixed CR and LF line endings not yet supported'
is "a\nb\r\rc".lines.join('|'), 'a|b||c', 'mixed .lines without trailing';
is "a\nb\r\rc\r".lines.join('|'), 'a|b||c', 'mixed .lines with trailing';
is "a\nb\r\rc\r".lines(2).join('|'), 'a|b', 'mixed .lines with limit';

is "a\nb\n\nc".lines.join('|'), 'a|b||c', '.lines without trailing \n';
is "a\nb\n\nc\n".lines.join('|'), 'a|b||c', '.lines with trailing \n';
is "a\nb\n\nc\n".lines(2).join('|'), 'a|b', '.lines with limit';
is lines("a\nb\nc\n").join('|'), 'a|b|c', '&lines';

# RT #115136
Expand Down

0 comments on commit 2dd48dc

Please sign in to comment.