@@ -5,9 +5,10 @@ use Test;
5
5
use Test ::Tap;
6
6
7
7
my @ simple = <a b c d e >;
8
+ my @ original ;
8
9
my @ endings = " \n " , " \r " , " \r\n " ;
9
10
10
- plan 11 ;
11
+ plan 21 ;
11
12
12
13
dies_ok { Supply . lines }, ' can not be called as a class method' ;
13
14
@@ -16,19 +17,31 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
16
17
17
18
tap_ok Supply . for ( @ simple . map : * ~ " \n " ). lines ,
18
19
@ simple ,
19
- " we can handle a simple list of lines with LF" ;
20
+ " handle a simple list of lines with LF" ;
21
+ tap_ok Supply . for ( @ original = @ simple . map : * ~ " \n " ). lines (:! chomp ),
22
+ @ original ,
23
+ " handle a simple list of lines with LF without chomping" ;
20
24
21
25
tap_ok Supply . for ( @ simple . map : * ~ " \r " ). lines ,
22
26
@ simple ,
23
- " we can handle a simple list of lines with CR" ;
27
+ " handle a simple list of lines with CR" ;
28
+ tap_ok Supply . for ( @ original = @ simple . map : * ~ " \r " ). lines (:! chomp ),
29
+ @ original ,
30
+ " handle a simple list of lines with CR without chomping" ;
24
31
25
32
tap_ok Supply . for ( @ simple . map : * ~ " \r\n " ). lines ,
26
33
@ simple ,
27
- " we can handle a simple list of lines with CRLF" ;
34
+ " handle a simple list of lines with CRLF" ;
35
+ tap_ok Supply . for ( @ original = @ simple . map : * ~ " \r\n " ). lines (:! chomp ),
36
+ @ original ,
37
+ " handle a simple list of lines with CRLF without chomping" ;
28
38
29
39
tap_ok Supply . for ( @ simple . map : * ~ @ endings . pick ). lines ,
30
40
@ simple ,
31
- " we can handle a simple list of lines with mixed line ending" ;
41
+ " handle a simple list of lines with mixed line ending" ;
42
+ tap_ok Supply . for (@ original = @ simple . map : * ~ @ endings . pick ). lines (:! chomp ),
43
+ @ original ,
44
+ " handle a simple list of lines with mixed line ending w/o chomping" ;
32
45
33
46
{
34
47
my $ s = Supply . new ;
@@ -43,4 +56,18 @@ for ThreadPoolScheduler.new, CurrentThreadScheduler -> $*SCHEDULER {
43
56
$ s . done ;
44
57
} );
45
58
}
59
+
60
+ {
61
+ my $ s = Supply . new ;
62
+ tap_ok $ s . lines (:! chomp ),
63
+ [" a\n " ," b\r\n " ," c\r " ," d\n " ," \n " ," eeee" ],
64
+ " handle chunked lines" ,
65
+ : after-tap( {
66
+ $ s . more( " a\n b\r " );
67
+ $ s . more( " \n c\r d\n " );
68
+ $ s . more( " \n e" );
69
+ $ s . more( " eee" );
70
+ $ s . done ;
71
+ } );
72
+ }
46
73
}
0 commit comments