@@ -38,7 +38,6 @@ is Blob.new(<1 2 3>).Int, 3, '.Int gives number of elements';
38
38
throws-like { Blob . new . chars }, X::Buf::AsStr , : method<chars >,
39
39
' attempting to call .chars throws' ;
40
40
41
- is Blob . new (<1 2 3 >). gist , ' Blob:0x<01 02 03>' , ' gist gives useful value' ;
42
41
is-deeply Blob . new (<1 2 3 >). reverse , Blob . new (<3 2 1 >),
43
42
' .reverse gives reversed Blob' ;
44
43
@@ -173,4 +172,21 @@ subtest 'arity-1 infix:<~> works on Blobs' => {
173
172
is-deeply ([~ ] [$ b ]), $ b , ' [~] works with array with 1 blob' ;
174
173
}
175
174
175
+ subtest ' .gist shows only first 100 els' => {
176
+ plan 5 ;
177
+ sub make-gist ($ blob , $ extras = []) {
178
+ ' Blob:0x<' ~ (| $ blob ». fmt (' %02x' ), | $ extras ) ~ ' >'
179
+ }
180
+
181
+ is Blob . new (<1 2 3 >). gist , ' Blob:0x<01 02 03>' , ' gist gives useful value' ;
182
+ is-deeply Blob . new (| $ _ ). gist , make-gist([1 .. 100 ]), ' 100 els'
183
+ with (1 .. 100 ). list;
184
+ is-deeply Blob . new (| $ _ ). gist , make-gist([1 .. 100 ], ' ...' ), ' 101 els'
185
+ with (1 .. 101 ). list;
186
+ is-deeply Blob . new (| $ _ ). gist , make-gist([1 .. 100 ], ' ...' ), ' 102 els'
187
+ with (1 .. 102 ). list;
188
+ is-deeply Blob . new (| $ _ ). gist , make-gist([1 .. 100 ], ' ...' ), ' 1000 els'
189
+ with (1 .. 1000 ). list;
190
+ }
191
+
176
192
# vim: ft=perl6
0 commit comments