@@ -66,7 +66,7 @@ while (<DATA>) {
66
66
my $o = re::optimization(eval " qr{$pat }" );
67
67
ok($o , " $comment compiled ok" );
68
68
69
- my $skip = ! $o ;
69
+ my $skip = $o ? undef : " could not get info for qr{ $pat } " ;
70
70
my $test = 0;
71
71
72
72
my ($got , $expect ) = ($o -> {minlen }, $minlen );
@@ -114,11 +114,18 @@ while (<DATA>) {
114
114
++$test ;
115
115
$skip || is($o -> {anchored_utf8 }, undef , " $comment no anchored utf8" );
116
116
}
117
+ # skip offset checks if we failed to find a string
118
+ my $local_skip = (
119
+ !$skip && !defined ($o -> {anchored } // $o -> {anchored_utf8 })
120
+ ) ? ' no anchored string' : undef ;
117
121
if (length $aoff ) {
118
122
++$test ;
119
- local $TODO = 1 if exists $todo {' anchored min offset' };
120
- $skip || is($o -> {' anchored min offset' }, $aoff ,
121
- " $comment anchored min offset" );
123
+ SKIP: {
124
+ skip($local_skip ) if $local_skip ;
125
+ local $TODO = 1 if exists $todo {' anchored min offset' };
126
+ $skip || is($o -> {' anchored min offset' }, $aoff ,
127
+ " $comment anchored min offset" );
128
+ }
122
129
# we don't care about anchored max: it may be set same as min or 0
123
130
}
124
131
@@ -143,27 +150,48 @@ while (<DATA>) {
143
150
++$test ;
144
151
$skip || is($o -> {floating_utf8 }, undef , " $comment no floating utf8" );
145
152
}
153
+ # skip offset checks if we failed to find a string
154
+ $local_skip = (
155
+ !$skip && !defined ($o -> {floating } // $o -> {floating_utf8 })
156
+ ) ? ' no floating string' : undef ;
146
157
if (length $fmin ) {
147
158
++$test ;
148
- local $TODO = 1 if exists $todo {' floating min offset' };
149
- $skip || is($o -> {' floating min offset' }, $fmin ,
150
- " $comment floating min offset" );
159
+ SKIP: {
160
+ skip($local_skip ) if $local_skip ;
161
+ local $TODO = 1 if exists $todo {' floating min offset' };
162
+ $skip || is($o -> {' floating min offset' }, $fmin ,
163
+ " $comment floating min offset" );
164
+ }
151
165
}
152
166
if (defined $fmax ) {
153
167
++$test ;
154
- local $TODO = 1 if exists $todo {' floating max offset' };
155
- $skip || is($o -> {' floating max offset' }, $fmax ,
156
- " $comment floating min offset" );
168
+ SKIP: {
169
+ skip($local_skip ) if $local_skip ;
170
+ local $TODO = 1 if exists $todo {' floating max offset' };
171
+ $skip || is($o -> {' floating max offset' }, $fmax ,
172
+ " $comment floating max offset" );
173
+ }
157
174
}
158
175
159
176
my $check = ($acheck eq ' +' ) ? ' anchored'
160
177
: ($fcheck eq ' +' ) ? ' floating'
161
178
: ($acheck eq ' -' ) ? undef
162
179
: ' none' ;
180
+ $local_skip = (
181
+ !$skip && $check && (
182
+ ($check eq ' anchored'
183
+ && !defined ($o -> {anchored } // $o -> {anchored_utf8 }))
184
+ || ($check eq ' floating'
185
+ && !defined ($o -> {floating } // $o -> {floating_utf8 }))
186
+ )
187
+ ) ? " $check not found" : undef ;
163
188
if (defined $check ) {
164
189
++$test ;
165
- local $TODO = 1 if exists $todo {checking };
166
- $skip || is($o -> {checking }, $check , " $comment checking $check " );
190
+ SKIP: {
191
+ skip($local_skip ) if $local_skip ;
192
+ local $TODO = 1 if exists $todo {checking };
193
+ $skip || is($o -> {checking }, $check , " $comment checking $check " );
194
+ }
167
195
}
168
196
169
197
# booleans
@@ -199,7 +227,7 @@ while (<DATA>) {
199
227
);
200
228
}
201
229
202
- skip($test ) if $skip ;
230
+ skip($skip , $ test ) if $skip ;
203
231
}
204
232
done_testing();
205
233
__END__
0 commit comments