From 2f6fd894054eb3104ed73f91719871d25db8a75e Mon Sep 17 00:00:00 2001 From: jnthn Date: Fri, 9 Oct 2015 18:53:30 +0200 Subject: [PATCH] A bunch more tests covering NFG casing issues. Hopefully correct, and covering various edge cases; there's no doubt some further ones. --- S15-nfg/case-change.t | 65 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/S15-nfg/case-change.t b/S15-nfg/case-change.t index c23d1f2ae4..3e6a45ca6f 100644 --- a/S15-nfg/case-change.t +++ b/S15-nfg/case-change.t @@ -1,6 +1,6 @@ use Test; -plan 20; +plan 52; # LATIN CAPITAL LETTER D, COMBINING DOT BELOW, COMBINING DOT ABOVE { @@ -18,6 +18,11 @@ plan 20; is $x.tc.chars, 1, 'tc still gives us one char'; is $x.tc, $x, 'tc gives identity'; is $x.tc.NFD.list, (0x0044, 0x0323, 0x0307), 'tc gives correct NFD'; + + #?rakudo.moar 3 skip 'NYI' + is $x.fc.chars, 1, 'fc still gives us one char'; + isnt $x.fc, $x, 'fc does not give identity'; + is $x.fc.NFD.list, (0x0064, 0x0323, 0x0307), 'fc gives correct NFD'; } # LATIN SMALL LETTER D, COMBINING DOT BELOW, COMBINING DOT ABOVE @@ -36,4 +41,62 @@ plan 20; is $x.tc.chars, 1, 'tc still gives us one char'; isnt $x.tc, $x, 'tc does not give identity'; is $x.tc.NFD.list, (0x0044, 0x0323, 0x0307), 'tc gives correct NFD'; + + #?rakudo.moar 3 skip 'NYI' + is $x.fc.chars, 1, 'fc still gives us one char'; + is $x.fc, $x, 'fc gives identity'; + is $x.fc.NFD.list, (0x0064, 0x0323, 0x0307), 'fc gives correct NFD'; +} + +# LATIN SMALL LETTER J WITH CARON, COMBINING DOT BELOW +# Interesting because on .uc, .tc there is no precomposed uppercase char, so +# we will have to form a new synthetic. And with .fc, the CaseFolder table +# has us take it to pieces, but we'll still need to re-compose it for NFG. +#?rakudo.moar skip 'NYI' +{ + my $x = Uni.new(0x01F0, 0x0323).Str; + is $x.chars, 1, 'Sanity: 0x01F0, 0x0323 = 1 grapheme'; + + is $x.uc.chars, 1, 'uc still gives us one char'; + isnt $x.uc, $x, 'uc does not give identity'; + is $x.uc.NFD.list, (0x004A, 0x0323, 0x030C), 'uc gives correct NFD'; + + is $x.lc.chars, 1, 'lc still gives us one char'; + is $x.lc, $x, 'lc gives identity'; + is $x.lc.NFD.list, (0x01F0, 0x0323), 'lc gives correct NFD'; + + is $x.tc.chars, 1, 'tc still gives us one char'; + isnt $x.tc, $x, 'tc does not give identity'; + is $x.tc.NFD.list, (0x004A, 0x0323, 0x030C), 'tc gives correct NFD'; + + is $x.fc.chars, 1, 'fc still gives us one char'; + is $x.fc, $x, 'fc gives identity'; + is $x.fc.NFD.list, (0x01F0, 0x0323), 'fc gives correct NFD'; +} + +# LATIN SMALL LIGATURE FF, COMBINING DOT BELOW +# This is trickier than the previous one. Which it can casefold to two +# codepoints, the second is a combiner. But this expands to two base +# chars, meaning that we need to make sure to sneak the combiner in +# between the two. +#?rakudo.moar skip 'NYI' +{ + my $x = Uni.new(0xFB00, 0x0323).Str; + is $x.chars, 1, 'Sanity: 0xFB00, 0x0323 = 1 grapheme'; + + is $x.uc.chars, 2, 'uc gives us 2 chars'; + isnt $x.uc, $x, 'uc does not give identity'; + is $x.uc.NFD.list, (0x0046, 0x0323, 0x0046), 'uc gives correct NFD'; + + is $x.lc.chars, 1, 'lc still gives us one char'; + is $x.lc, $x, 'lc gives identity'; + is $x.lc.NFD.list, (0xFB00, 0x0323), 'lc gives correct NFD'; + + is $x.tc.chars, 2, 'tc gives us two chars'; + isnt $x.tc, $x, 'tc does not give identity'; + is $x.tc.NFD.list, (0x0046, 0x0323, 0x0066), 'tc gives correct NFD'; + + is $x.fc.chars, 2, 'fc gives us two chars'; + isnt $x.fc, $x, 'fc gives identity'; + is $x.fc.NFD.list, (0x0066, 0x0323, 0x0066), 'fc gives correct NFD'; }