Skip to content

Commit 94e7daa

Browse files
committed
Update Emoji and Grapheme Break Tests to version Unicode version 11.0
1 parent e790bb1 commit 94e7daa

File tree

6 files changed

+3210
-3110
lines changed

6 files changed

+3210
-3110
lines changed

3rdparty/Unicode/11.0.0/ucd/auxiliary/GraphemeBreakTest.txt

Lines changed: 700 additions & 0 deletions
Large diffs are not rendered by default.

3rdparty/Unicode/9.0.0/ucd/auxiliary/GraphemeBreakTest.txt

Lines changed: 0 additions & 849 deletions
This file was deleted.

S15-nfg/GraphemeBreakTest.t

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
## WHEN UPDATING UNICODE VERSION ALSO UPDATE docs/unicode-generated-tests.asciidoc
12
use v6;
2-
my IO::Path $repo-dir = $?FILE.IO.parent(2).add("3rdparty/Unicode/9.0.0/ucd/auxiliary/GraphemeBreakTest.txt");
3+
my IO::Path $repo-dir = $?FILE.IO.parent(2).add("3rdparty/Unicode/11.0.0/ucd/auxiliary/GraphemeBreakTest.txt");
34
my IO::Path $rakudo-subdir = $?FILE.IO.parent(2);
45
my IO::Path $rakudo-dir = $rakudo-subdir.child($repo-dir);
56
my Str:D $location = $rakudo-dir.e ?? $rakudo-dir.Str !! $repo-dir.Str;
@@ -45,22 +46,25 @@ values are either set to ALL or set to one or more of C,0,1,2,3,4..
4546
=end pod
4647

4748
constant %fudged-tests = {
48-
573 => ['ALL'],
49-
733 => ['ALL'],
49+
694 => ['ALL'],
50+
695 => ['ALL'],
51+
591 => ['ALL'],
5052
};
5153
constant @lines-with-normalization = (
52-
442 => [ 0, ],
53-
825 => [ 0, ],
54-
829 => [ 0, ],
55-
837 => [ 0, ],
54+
441 => [0, ],
55+
674 => [ 0, ],
56+
678 => [ 0, ],
57+
679 => [ 0, ],
58+
686 => [ 0, ],
5659
);
5760
sub MAIN (Str:D :$file = $location, Str :$only, Bool:D :$debug = False) {
5861
$DEBUG = $debug;
62+
note "WHEN UPDATING UNICODE VERSION ALSO UPDATE docs/unicode-generated-tests.asciidoc";
5963
my @only = $only ?? $only.split([',', ' ']) !! Empty;
6064
die "Can't find file at ", $file.IO.absolute unless $file.IO.f;
6165
note "Reading file ", $file.IO.absolute;
6266
my @fail;
63-
plan (@only.elems or 2411);
67+
plan (1943);
6468
for $file.IO.lines -> $line {
6569
process-line $line, @fail, :@only;
6670
}
@@ -145,7 +149,8 @@ sub process-line (Str:D $line, @fail, :@only!) {
145149
}
146150
}
147151
if $expected.chrs.ords.Array !eqv $expected {
148-
die "codepoints change under normalization. manually check and add an exception or fix the script\nline no $line-no: elem $elem: ", $expected.chrs.ords.Array, ' - ', $expected;
152+
die "codepoints change under normalization. manually check and add an exception or fix the script\n" ~ "
153+
line no $line-no: elem $elem. Got: ", $expected.chrs.ords.Array.join(', '), ' from: ', $expected.join(',');
149154
}
150155
}
151156
is-deeply $list<string>.substr($elem, 1).ords.flat.Array, $expected, "Line $line-no: grapheme [$elem] has correct codepoints" or @fail.push($line-no);

S15-nfg/emoji-test-gen.p6

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/usr/bin/env perl6
2+
## WHEN UPDATING UNICODE VERSION ALSO UPDATE docs/unicode-generated-tests.asciidoc
23
# Generates tests from GraphemeBreakPropertyTest.txt from UNIDATA
34
# At the moment this test only checks how many graphemes we think exist
45
# in the string. The test itself defines points where we should break or
56
# not break. For now we just test if the number of graphemes is correct.
67
# This is mostly good enough.
78
use v6;
89
sub MAIN ( Str $EmojiTest-file ) {
10+
note "WHEN UPDATING UNICODE VERSION ALSO UPDATE docs/unicode-generated-tests.asciidoc";
911
my @text = $EmojiTest-file.IO.slurp.lines;
1012
my $line-no = 0;
1113
my $emoji-version;
@@ -50,7 +52,7 @@ sub MAIN ( Str $EmojiTest-file ) {
5052
}
5153
my $file =
5254
qq:to/END/;
53-
# Test generated from GraphemeBreakTest.txt Emoji version $emoji-version
55+
# Test generated from emoji-test.txt Emoji version $emoji-version
5456
use v6;
5557
use Test;
5658
plan $test-count;

0 commit comments

Comments
 (0)