Skip to content

Commit 9b22fca

Browse files
committed
Unicode/UCD.t: Handle inverted empty properties
This situation had not come up before Unicode 16.0
1 parent 97ca3e2 commit 9b22fca

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

lib/Unicode/UCD.t

+32-7
Original file line numberDiff line numberDiff line change
@@ -1543,13 +1543,29 @@ foreach my $set_of_tables (\%Unicode::UCD::stricter_to_file_of, \%Unicode::UCD::
15431543
chomp $official;
15441544
$/ = $input_record_separator;
15451545

1546-
# If we are to test against an inverted file, it is easier to invert
1547-
# our array than the file.
15481546
if ($invert) {
1549-
if (@tested && $tested[0] == 0) {
1550-
shift @tested;
1551-
} else {
1552-
unshift @tested, 0;
1547+
1548+
# Special case an inverted empty file
1549+
if (@tested == 0) {
1550+
if ($official ne 'V0') {
1551+
fail_with_diff($mod_table, $official, 'V0',
1552+
"prop_invlist");
1553+
}
1554+
else {
1555+
pass("prop_invlist('$mod_table')");
1556+
}
1557+
1558+
next;
1559+
}
1560+
else {
1561+
1562+
# If we are to test against an inverted file, it is easier to
1563+
# invert our array than the file.
1564+
if ($tested[0] == 0) {
1565+
shift @tested;
1566+
} else {
1567+
unshift @tested, 0;
1568+
}
15531569
}
15541570
}
15551571

@@ -2079,9 +2095,18 @@ foreach my $prop (sort(keys %props)) {
20792095
# it's an error
20802096
my %specials = %$specials_ref if $specials_ref;
20812097
2098+
# Special case an expected and gotten empty return
2099+
if ( @$invlist_ref - $upper_limit_subtract == 1
2100+
&& $official =~ / ^ ( V0 | !Unicode::UCD::All ) \z /x)
2101+
{
2102+
pass("prop_invmap('$display_prop')");
2103+
next PROPERTY;
2104+
}
2105+
20822106
# The extra -$upper_limit_subtract is because the final element may
20832107
# have been tested above to be for anything above Unicode, in which
2084-
# case the file may not go that high.
2108+
# case the file may not go that high. The upper bound may be changed
2109+
# in the loop, so can't pre-calculate it.
20852110
for (my $i = 0; $i < @$invlist_ref - $upper_limit_subtract; $i++) {
20862111
20872112
# If the map element is a reference, have to stringify it (but

0 commit comments

Comments
 (0)