Skip to content

Commit

Permalink
Add tests for <:LC>, <:Digit> and Line_Break = XX
Browse files Browse the repository at this point in the history
Add regex tests for <:LC> (Letter Cased), <:Digit> (Numeric_Type=Digit)
and that .uniprop('Line_Break') returns XX as its default value for
unassigned codepoints.
  • Loading branch information
samcv committed Nov 29, 2017
1 parent c39830a commit ac52954
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions S05-mass/properties-general.t
Expand Up @@ -15,7 +15,7 @@ Unicode 5.2.
=end pod

plan 610;
plan 614;

# L Letter

Expand Down Expand Up @@ -51,7 +51,7 @@ ok(!( "\x[C767]" ~~ m/^<:Lu>$/ ), q{Don't match related <Lu> (UppercaseLetter)}
ok("\x[C767]" ~~ m/^<:!Lu>$/, q{Match related negated <Lu> (UppercaseLetter)} );
ok("\x[C767]" ~~ m/^<-:Lu>$/, q{Match related inverted <Lu> (UppercaseLetter)} );
ok("\x[C767]\x[C767]\c[LATIN CAPITAL LETTER A]" ~~ m/<:Lu>/, q{Match unanchored <Lu> (UppercaseLetter)} );

ok("A" ~~ /<:LC>/, "Match letter 'Letter Uppercase' (LU)");
ok("\c[LATIN CAPITAL LETTER A]" ~~ m/^<:UppercaseLetter>$/, q{Match <:UppercaseLetter>} );
ok(!( "\c[LATIN CAPITAL LETTER A]" ~~ m/^<:!UppercaseLetter>$/ ), q{Don't match negated <UppercaseLetter>} );
ok(!( "\c[LATIN CAPITAL LETTER A]" ~~ m/^<-:UppercaseLetter>$/ ), q{Don't match inverted <UppercaseLetter>} );
Expand Down Expand Up @@ -829,4 +829,7 @@ is ' ' ~~ m/<:White_Space>+/, ' ', '<:White_Space> matches space in regex';
# https://github.com/MoarVM/MoarVM/issues/521
is '' ~~ m/<alpha>/, '', '<alpha> matches alphabetics which are not Letters';

is 0x00B2.chr ~~ /<:Digit>/, 0x00B2.chr, "Digit matches Numeric_Type=Digit";
nok "a" ~~ /<:Digit>/, "Digit doesn't match normal letters";
nok "9" ~~ /<:Digit>/, "Digit doesn't match things with property value Decimal";
# vim: ft=perl6
4 changes: 3 additions & 1 deletion S15-unicode-information/uniprop.t
Expand Up @@ -2,7 +2,7 @@ use v6;

use Test;

plan 196;
plan 198;

#use unicode :v(6.3);

Expand Down Expand Up @@ -112,6 +112,7 @@ is "½".uniprop('Numeric_Value'), 0.5, "'½'.uniprop('Numeric_Value') returns th
is "a".uniprop('Numeric_Value'), NaN, "'a'.uniprop('Numeric_Value') returns NaN";
is '1'.uniprop('Numeric_Type'), 'Decimal', "uniprop for Numeric_Type returns 'Decimal' for decimal numbers";
is 'a'.uniprop('Numeric_Type'), 'None', "uniprop for Numeric_Type returns 'None' for non-numbers";
is 0x00B2.uniprop('Numeric_Type'), 'Digit', "uniprop for Numeric_Type returns 'Digit' for ones with this property";

## Binary Properties
is-deeply '0'.uniprop('Alphabetic'), False, "'0'.uniprop('Alphabetic') returns a False";
Expand Down Expand Up @@ -244,6 +245,7 @@ is 0xFB1F.uniprop('Word_Break'), 'Hebrew_Letter', "0xFB1F.uniprop('Word_Break')
is "\n".uniprop('Line_Break'), 'LF', "\n".uniprop('Line_Break') return LF;
is 0x200D.uniprop('Line_Break'), 'ZWJ', uniprop('Line_Break') returns ZWJ for U+200D ZERO WIDTH JOINER;
is 0x103D.uniprop('Line_Break'), 'SA', uniprop('Line_Break') returns SA for U+103D MYANMAR CONSONANT SIGN MEDIAL WA;
is 0xFFFF.uniprop('Line_Break'), 'XX', "uniprop('Line_Break') returns XX for noncharacters";

is 'Ö'.uniprop('Decomposition_Type'), 'Canonical', 'uniprop for Decomposition_Type returns Canonical for Canonical value codes';
#?rakudo.moar 3 todo "MoarVM returns N/M/Y instead of their full names"
Expand Down

0 comments on commit ac52954

Please sign in to comment.