2
2
3
3
use Test ;
4
4
5
- plan 37 ;
5
+ plan 38 ;
6
6
7
7
= begin description
8
8
@@ -13,9 +13,9 @@ This test tests the C<squish> builtin and .squish method on Any/List.
13
13
# ?niecza skip 'NYI'
14
14
{
15
15
my @ array = <a b b c d e f f a >;
16
- is-deeply @ array . squish, <a b c d e f a >. list . item ,
16
+ is-deeply @ array . squish. list , <a b c d e f a >,
17
17
" method form of squish works" ;
18
- is-deeply squish(@ array ), <a b c d e f a >. list . item ,
18
+ is-deeply squish(@ array ). list , <a b c d e f a >,
19
19
" subroutine form of squish works" ;
20
20
is-deeply @ array .= squish, [<a b c d e f a >],
21
21
" inplace form of squish works" ;
@@ -24,8 +24,8 @@ This test tests the C<squish> builtin and .squish method on Any/List.
24
24
} # 4
25
25
26
26
{
27
- is-deeply squish(Any ,' a' , ' b' , ' b' , ' c' , ' d' , ' e' , ' f' , ' f' , ' a' ),
28
- (Any , <a b c d e f a >. list) . list . item ,
27
+ is-deeply squish(Any ,' a' , ' b' , ' b' , ' c' , ' d' , ' e' , ' f' , ' f' , ' a' ). list ,
28
+ (flat Any , <a b c d e f a >) ,
29
29
' slurpy subroutine form of squish works' ;
30
30
} # 1
31
31
@@ -50,17 +50,18 @@ This test tests the C<squish> builtin and .squish method on Any/List.
50
50
51
51
# ?niecza skip 'NYI'
52
52
{
53
- my @ a := squish( 1 .. Inf );
54
- is @ a [3 ], 4 , " make sure squish is lazy" ;
53
+ my \a := squish( 1 .. Inf );
54
+ ok a. is-lazy , ' squish knows itself to be lazy' ;
55
+ is a[3 ], 4 , ' ... can access elements from lazy iterator' ;
55
56
} # 1
56
57
57
58
# ?niecza skip 'NYI'
58
59
{
59
60
my @ array = <a b bb c d e f f a >;
60
61
my $ as = *. substr : 0 ,1 ;
61
- is-deeply @ array . squish(: $ as ), <a b c d e f a >. list . item ,
62
+ is-deeply @ array . squish(: $ as ). list , <a b c d e f a >,
62
63
" method form of squish with :as works" ;
63
- is-deeply squish(@ array ,: $ as ), <a b c d e f a >. list . item ,
64
+ is-deeply squish(@ array ,: $ as ). list , <a b c d e f a >,
64
65
" subroutine form of squish with :as works" ;
65
66
is-deeply @ array .= squish(: $ as ), [<a b c d e f a >],
66
67
" inplace form of squish with :as works" ;
@@ -72,14 +73,14 @@ This test tests the C<squish> builtin and .squish method on Any/List.
72
73
{
73
74
my @ rt124204 = (' ' , ' ' , Any , Any );
74
75
# ?rakudo todo 'RT #124204'
75
- is-deeply @ rt124204 . squish(: as(-> $ x {$ x })), (' ' , Any ). list . item ,
76
+ is-deeply @ rt124204 . squish(: as(-> $ x {$ x })). list , (' ' , Any ),
76
77
" method form of squish with :as does not needlessly stringify" ;
77
- is-deeply @ rt124204 . squish, (' ' , Any ). list . item ,
78
+ is-deeply @ rt124204 . squish. list , (' ' , Any ),
78
79
" method form of squish without :as does not needlessly stringify" ;
79
80
# ?rakudo todo 'RT #124204'
80
- is-deeply @ rt124204 . squish(: as(-> $ x {$ x }), : with({$ ^ b === $ ^ a })), (' ' , Any ). list . item ,
81
+ is-deeply @ rt124204 . squish(: as(-> $ x {$ x }), : with({$ ^ b === $ ^ a })). list , (' ' , Any ),
81
82
" method form of squish with :as and :with does not needlessly stringify" ;
82
- is-deeply @ rt124204 . squish(: with({$ ^ b === $ ^ a })), (' ' , Any ). list . item ,
83
+ is-deeply @ rt124204 . squish(: with({$ ^ b === $ ^ a })). list , (' ' , Any ),
83
84
" method form of squish with :with does not needlessly stringify" ;
84
85
} # 4
85
86
@@ -88,19 +89,19 @@ This test tests the C<squish> builtin and .squish method on Any/List.
88
89
{
89
90
my @ rt124205 = <a a >;
90
91
91
- is-deeply @ rt124205 . squish(: as(-> $ x {1 }), : with(-> $ a , $ b {1 })), <a >. list. item ,
92
+ is-deeply @ rt124205 . squish(: as(-> $ x {1 }), : with(-> $ a , $ b {1 })). list , <a >. list,
92
93
" method form of squish with :as and :with always returns at least the first element" ;
93
- is-deeply @ rt124205 . squish(: with(-> $ a , $ b {1 })), <a >. list. item ,
94
+ is-deeply @ rt124205 . squish(: with(-> $ a , $ b {1 })). list , <a >. list,
94
95
" method form of squish with :with always returns at least the first element" ;
95
96
96
97
# somewhat more real-world examples:
97
98
98
99
my @ rt124205_b = ' ' , ' ' , <b b B B >;
99
100
100
- is-deeply @ rt124205_b . squish(: with(*. Str eq *. Str )), (' ' , ' b' , ' B' ). list . item ,
101
+ is-deeply @ rt124205_b . squish(: with(*. Str eq *. Str )). list , (' ' , ' b' , ' B' ),
101
102
" method form of squish with :with preserves the first element even if it stringifies to ''" ;
102
103
103
- is-deeply @ rt124205_b . squish(: as(*. Str ), : with(& infix : <eq >)), (' ' , ' b' , ' B' ). list . item ,
104
+ is-deeply @ rt124205_b . squish(: as(*. Str ), : with(& infix : <eq >)). list , (' ' , ' b' , ' B' ),
104
105
" method form of squish with :as and :with preserves the first element even if it stringifies to ''" ;
105
106
106
107
} # 4
@@ -109,9 +110,9 @@ This test tests the C<squish> builtin and .squish method on Any/List.
109
110
{
110
111
my @ array = <a aa b bb c d e f f a >;
111
112
my $ with = { substr ($ ^ a ,0 ,1 ) eq substr ($ ^ b ,0 ,1 ) }
112
- is-deeply @ array . squish(: $ with ), <a b c d e f a >. list . item ,
113
+ is-deeply @ array . squish(: $ with ). list , <a b c d e f a >,
113
114
" method form of squish with :with works" ;
114
- is-deeply squish(@ array ,: $ with ), <a b c d e f a >. list . item ,
115
+ is-deeply squish(@ array ,: $ with ). list , <a b c d e f a >,
115
116
" subroutine form of squish with :with works" ;
116
117
is-deeply @ array .= squish(: $ with ), [<a b c d e f a >],
117
118
" inplace form of squish with :with works" ;
@@ -124,9 +125,9 @@ This test tests the C<squish> builtin and .squish method on Any/List.
124
125
my @ array = <a aa b bb c d e f f a >;
125
126
my $ as = *. substr (0 ,1 ). ord ;
126
127
my $ with = &[== ];
127
- is-deeply @ array . squish(: $ as , : $ with ), <a b c d e f a >. list . item ,
128
+ is-deeply @ array . squish(: $ as , : $ with ). list , <a b c d e f a >,
128
129
" method form of squish with :as and :with works" ;
129
- is-deeply squish(@ array ,: $ as , : $ with ), <a b c d e f a >. list . item ,
130
+ is-deeply squish(@ array ,: $ as , : $ with ). list , <a b c d e f a >,
130
131
" subroutine form of squish with :as and :with works" ;
131
132
is-deeply @ array .= squish(: $ as , : $ with ), [<a b c d e f a >],
132
133
" inplace form of squish with :as and :with works" ;
@@ -138,9 +139,9 @@ This test tests the C<squish> builtin and .squish method on Any/List.
138
139
{
139
140
my @ array = ({: a<1 >}, {: a<1 >}, {: b<1 >});
140
141
my $ with = &[eqv ];
141
- is-deeply @ array . squish(: $ with ), ({: a<1 >}, {: b<1 >}). list . item ,
142
+ is-deeply @ array . squish(: $ with ). list , ({: a<1 >}, {: b<1 >}),
142
143
" method form of squish with [eqv] and objects works" ;
143
- is-deeply squish(@ array ,: $ with ), ({: a<1 >}, {: b<1 >}). list . item ,
144
+ is-deeply squish(@ array ,: $ with ). list , ({: a<1 >}, {: b<1 >}),
144
145
" subroutine form of squish with [eqv] and objects works" ;
145
146
is-deeply @ array .= squish(: $ with ), [{: a<1 >}, {: b<1 >}],
146
147
" inplace form of squish with [eqv] and objects works" ;
@@ -152,11 +153,11 @@ This test tests the C<squish> builtin and .squish method on Any/List.
152
153
{
153
154
my $ a = <a b b c >;
154
155
$ a .= squish;
155
- is-deeply ( $ a , <a b c >. list . item , ' .= squish in sink context works on $a' );
156
+ is-deeply ( $ a . list , <a b c >, ' .= squish in sink context works on $a' );
156
157
my @ a = <a b b c >;
157
158
@ a .= squish;
158
159
is-deeply ( @ a , [<a b c >], ' .= squish in sink context works on @a' );
159
160
} # 2
160
161
161
- is ((3 ,3 ,1 ),(1 ,2 ),(1 ,2 )). squish, ' 3 3 1 1 2' , " .squish doesn't flatten" ;
162
+ is ((3 ,3 ,1 ),(1 ,2 ),(1 ,2 )). squish. list . Str , ' 3 3 1 1 2' , " .squish doesn't flatten" ;
162
163
# vim: ft=perl6
0 commit comments