Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Unfudge and add some more Str.lines tests
  • Loading branch information
lizmat committed Sep 10, 2014
1 parent e8acf51 commit 3d7042c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions S32-str/lines.t
Expand Up @@ -4,29 +4,39 @@ use Test;
use lib 't/spec/packages';
use Test::Util;

plan 14;
plan 23;

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(Inf).join('|'),'a|b||c', 'LF .lines with Inf';
is "a\nb\n\nc\n".lines(*).join('|'), 'a|b||c', 'LF .lines with *';
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(Inf).join('|'),'a|b||c', 'CR .lines with Inf';
is "a\rb\r\rc\r".lines(*).join('|'), 'a|b||c', 'CR .lines with *';
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(Inf).join('|'), 'a|b||c',
'CRLF .lines with Inf';
is "a\r\nb\r\n\r\nc\r\n".lines(*).join('|'), 'a|b||c',
'CRLF .lines with *';
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(Inf).join('|'),'a|b||c', 'mixed .lines with Inf';
is "a\nb\r\rc\r".lines(*).join('|'), 'a|b||c', 'mixed .lines with *';
is "a\nb\r\rc\r".lines(2).join('|'), 'a|b', 'mixed .lines with limit';

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

# RT #115136
is_run( 'print lines[0]',
Expand Down

0 comments on commit 3d7042c

Please sign in to comment.