From 3282ee13c09f8fd1009f35571059ec6e8204b2ec Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 12 Mar 2019 11:36:48 -0600 Subject: [PATCH] Add tests for wildcards in Unicode property values --- charclass_invlists.h | 2 +- lib/unicore/mktables | 48 ++++++++++++++++++++++++++++++++++++++++++++- lib/unicore/uni_keywords.pl | 2 +- regcharclass.h | 2 +- uni_keywords.h | 2 +- 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/charclass_invlists.h b/charclass_invlists.h index d7f6d73..e08b788 100644 --- a/charclass_invlists.h +++ b/charclass_invlists.h @@ -393648,7 +393648,7 @@ static const U8 WB_table[23][23] = { * 5f98a68d5aa76b06052fe16312d2fdf17547fd69c4e648532845e11beaf2002b lib/unicore/extracted/DLineBreak.txt * 8011b1733f6d2cc17576b2a1e20067eca51205e8e0b740d00ebd52afbec2ea39 lib/unicore/extracted/DNumType.txt * 8b677a4cf17a4c6949632146fa8a99aaa65689a41b9dd231f81783e81600ff36 lib/unicore/extracted/DNumValues.txt - * 1800eb840c855560eea3a088e7e80ecd67611fabaabfd64710f144858a48d256 lib/unicore/mktables + * 56461f8238f671a5e686ca8cacd508e67d6d0b7a14ac6096938af435f76d36e0 lib/unicore/mktables * 93cc868487ef3345596041bcb90c302b1b056733bb95233101bc10dc2dbe36b4 lib/unicore/version * 2680b9254eb236c5c090f11b149605043e8c8433661b96efc4a42fb4709342a5 regen/charset_translations.pl * 03e51b0f07beebd5da62ab943899aa4934eee1f792fa27c1fb638c33bf4ac6ea regen/mk_PL_charclass.pl diff --git a/lib/unicore/mktables b/lib/unicore/mktables index 760b011..ee214d1 100644 --- a/lib/unicore/mktables +++ b/lib/unicore/mktables @@ -18872,6 +18872,34 @@ EOC return @output; } +sub generate_wildcard_tests($$$$$) { + # This used only for making the test script. It generates wildcardl + # matching test cases that are expected to compile successfully in perl. + + my $lhs = shift; # The property: what's to the left of the + # or equals separator + my $rhs = shift; # The property value; what's to the right + my $valid_code = shift; # A code point that's known to be in the + # table given by LHS=RHS; undef if table is + # empty + my $invalid_code = shift; # A code point known to not be in the table; + # undef if the table is all code points + my $warning = shift; + + return if $lhs eq ""; + return if $lhs =~ / ^ Is_ /x; # These are not currently supported + + # Generate a standardized pattern, with colon being the delimitter + my $wildcard = "$lhs=:\\A$rhs\\z:"; + + my @output; + push @output, "Expect(1, $valid_code, '\\p{$wildcard}', $warning);" + if defined $valid_code; + push @output, "Expect(0, $invalid_code, '\\p{$wildcard}', $warning);" + if defined $invalid_code; + return @output; +} + sub generate_error($$$) { # This used only for making the test script. It generates test cases that # are expected to not only not match, but to be syntax or similar errors @@ -19179,7 +19207,16 @@ EOF_CODE # quit now without generating success cases. next if $already_error; - # Now for the success cases. + # Now for the success cases. First, wildcard matching, as it + # shouldn't have any randomization. + if ($table_alias->status eq $NORMAL) { + push @output, generate_wildcard_tests($property_name, + $table_name, + $valid, + $invalid, + $warning, + ); + } my $random; if ($loose_match) { @@ -19200,6 +19237,15 @@ EOF_CODE $invalid, $warning, ); + if ($table_alias->status eq $NORMAL) { + push @output, generate_wildcard_tests( + $property_name, + $standard, + $valid, + $invalid, + $warning, + ); + } } $random = randomize_loose_name($table_name) } diff --git a/lib/unicore/uni_keywords.pl b/lib/unicore/uni_keywords.pl index 05b15ba..d1446c7 100644 --- a/lib/unicore/uni_keywords.pl +++ b/lib/unicore/uni_keywords.pl @@ -1258,7 +1258,7 @@ # 5f98a68d5aa76b06052fe16312d2fdf17547fd69c4e648532845e11beaf2002b lib/unicore/extracted/DLineBreak.txt # 8011b1733f6d2cc17576b2a1e20067eca51205e8e0b740d00ebd52afbec2ea39 lib/unicore/extracted/DNumType.txt # 8b677a4cf17a4c6949632146fa8a99aaa65689a41b9dd231f81783e81600ff36 lib/unicore/extracted/DNumValues.txt -# 1800eb840c855560eea3a088e7e80ecd67611fabaabfd64710f144858a48d256 lib/unicore/mktables +# 56461f8238f671a5e686ca8cacd508e67d6d0b7a14ac6096938af435f76d36e0 lib/unicore/mktables # 93cc868487ef3345596041bcb90c302b1b056733bb95233101bc10dc2dbe36b4 lib/unicore/version # 2680b9254eb236c5c090f11b149605043e8c8433661b96efc4a42fb4709342a5 regen/charset_translations.pl # 03e51b0f07beebd5da62ab943899aa4934eee1f792fa27c1fb638c33bf4ac6ea regen/mk_PL_charclass.pl diff --git a/regcharclass.h b/regcharclass.h index 8e664bf..207f917 100644 --- a/regcharclass.h +++ b/regcharclass.h @@ -1909,7 +1909,7 @@ * 5f98a68d5aa76b06052fe16312d2fdf17547fd69c4e648532845e11beaf2002b lib/unicore/extracted/DLineBreak.txt * 8011b1733f6d2cc17576b2a1e20067eca51205e8e0b740d00ebd52afbec2ea39 lib/unicore/extracted/DNumType.txt * 8b677a4cf17a4c6949632146fa8a99aaa65689a41b9dd231f81783e81600ff36 lib/unicore/extracted/DNumValues.txt - * 1800eb840c855560eea3a088e7e80ecd67611fabaabfd64710f144858a48d256 lib/unicore/mktables + * 56461f8238f671a5e686ca8cacd508e67d6d0b7a14ac6096938af435f76d36e0 lib/unicore/mktables * 93cc868487ef3345596041bcb90c302b1b056733bb95233101bc10dc2dbe36b4 lib/unicore/version * 2680b9254eb236c5c090f11b149605043e8c8433661b96efc4a42fb4709342a5 regen/charset_translations.pl * 88bd981dbb45f57767c414170f85067c6e01b5afbc1e40c6514a2bc41ed8c1d8 regen/regcharclass.pl diff --git a/uni_keywords.h b/uni_keywords.h index 9d06d7a..138ef62 100644 --- a/uni_keywords.h +++ b/uni_keywords.h @@ -7276,7 +7276,7 @@ MPH_VALt match_uniprop( const unsigned char * const key, const U16 key_len ) { * 5f98a68d5aa76b06052fe16312d2fdf17547fd69c4e648532845e11beaf2002b lib/unicore/extracted/DLineBreak.txt * 8011b1733f6d2cc17576b2a1e20067eca51205e8e0b740d00ebd52afbec2ea39 lib/unicore/extracted/DNumType.txt * 8b677a4cf17a4c6949632146fa8a99aaa65689a41b9dd231f81783e81600ff36 lib/unicore/extracted/DNumValues.txt - * 1800eb840c855560eea3a088e7e80ecd67611fabaabfd64710f144858a48d256 lib/unicore/mktables + * 56461f8238f671a5e686ca8cacd508e67d6d0b7a14ac6096938af435f76d36e0 lib/unicore/mktables * 93cc868487ef3345596041bcb90c302b1b056733bb95233101bc10dc2dbe36b4 lib/unicore/version * 2680b9254eb236c5c090f11b149605043e8c8433661b96efc4a42fb4709342a5 regen/charset_translations.pl * 03e51b0f07beebd5da62ab943899aa4934eee1f792fa27c1fb638c33bf4ac6ea regen/mk_PL_charclass.pl -- 1.8.3.1