1
1
use v6 ;
2
+ use lib $ ? FILE . IO . parent (2 ). add: ' packages' ;
2
3
use Test ;
4
+ use Test ::Util;
3
5
plan 9 ;
4
6
5
7
# L<S32::Str/Str/ords>
@@ -18,7 +20,7 @@ is ".\x[301]".ords, (46, 769), 'ords does not lose NFG synthetics (method)';
18
20
19
21
# https://github.com/rakudo/rakudo/commit/8b7385d810
20
22
subtest ' optimization coverage' => {
21
- plan 7 ;
23
+ plan 4 ;
22
24
my $ s := " e\x [ 308] abc" ;
23
25
my @ ords := 235 , 97 , 98 , 99 ;
24
26
@@ -27,37 +29,6 @@ subtest 'optimization coverage' => {
27
29
is-deeply @ target-s , [@ ords ], ' .push-all (has chars)' ;
28
30
is-deeply @ target-e , [], ' .push-all (no chars)' ;
29
31
30
- is-deeply + $ s . ords , 4 , ' .count-only (has chars)' ;
31
- is-deeply + " " . ords , 0 , ' .count-only (no chars)' ;
32
- is-deeply ? $ s . ords , True , ' .bool-only (has chars)' ;
33
- is-deeply ? " " . ords , False , ' .bool-only (no chars)' ;
34
-
35
- with $ s . ords . iterator -> \iter {
36
- subtest ' partially-iterated iterator' => {
37
- plan 17 ;
38
-
39
- is-deeply iter. count-only, 4 , ' count (1)' ;
40
- is-deeply iter. bool -only, True , ' bool (1)' ;
41
-
42
- is-deeply iter. pull-one , @ ords [0 ], ' char (2)' ;
43
- is-deeply iter. count-only, 3 , ' count (2)' ;
44
- is-deeply iter. bool -only, True , ' bool (2)' ;
45
-
46
- is-deeply iter. pull-one , @ ords [1 ], ' char (3)' ;
47
- is-deeply iter. count-only, 2 , ' count (3)' ;
48
- is-deeply iter. bool -only, True , ' bool (3)' ;
49
-
50
- is-deeply iter. pull-one , @ ords [2 ], ' char (4)' ;
51
- is-deeply iter. count-only, 1 , ' count (4)' ;
52
- is-deeply iter. bool -only, True , ' bool (4)' ;
53
-
54
- is-deeply iter. pull-one , @ ords [3 ], ' char (5)' ;
55
- is-deeply iter. count-only, 0 , ' count (5)' ;
56
- is-deeply iter. bool -only, False , ' bool (5)' ;
57
-
58
- ok iter. pull-one =:= IterationEnd, ' char (6)' ;
59
- is-deeply iter. count-only, 0 , ' count (6)' ;
60
- is-deeply iter. bool -only, False , ' bool (6)' ;
61
- }
62
- }
32
+ test-iter-opt $ s . ords . iterator , @ ords , ' has chars' ;
33
+ test-iter-opt " " . ords . iterator , (), ' no chars' ;
63
34
}
0 commit comments