@@ -3,6 +3,11 @@ import parseSpecialCasing from '../scripts/parse-special-casing.mjs';
33import parseEmoji from '../scripts/parse-emoji.mjs' ;
44import parseEmojiSequences from '../scripts/parse-emoji-sequences.mjs' ;
55import parseBidiBrackets from '../scripts/parse-bidi-brackets.mjs' ;
6+ import parseNameAliases from '../scripts/parse-name-aliases.mjs' ;
7+ import {
8+ parseBlocks ,
9+ parseDerivedCoreProperties ,
10+ } from '../scripts/parse-blocks-scripts-properties.mjs' ;
611import utils from '../scripts/utils.mjs' ;
712
813test ( 'SpecialCasing accepts optional comments and flexible whitespace' , async ( t ) => {
@@ -28,6 +33,52 @@ FB00 ; FB00 ; 0046 0066 ; 0046 0046 ; # comment with # and ; characters
2833 ] ) ;
2934} ) ;
3035
36+ test ( 'Semicolons inside comments do not turn binary records into enumerated records' , async ( t ) => {
37+ t . mock . method (
38+ utils ,
39+ 'readDataFile' ,
40+ ( ) => `
41+ 0041 ; Alphabetic # note; still a comment
42+ 0300 ; InCB; Extend # an actual enumerated property
43+ ` ,
44+ ) ;
45+ const map = await parseDerivedCoreProperties ( '18.0.0' ) ;
46+ t . assert . deepEqual ( Object . keys ( map ) , [ 'Alphabetic' ] ) ;
47+ t . assert . deepEqual ( map . Alphabetic . toArray ( ) , [ 0x41 ] ) ;
48+ } ) ;
49+
50+ test ( 'Block names exclude inline comments in modern and legacy formats' , async ( t ) => {
51+ t . mock . method ( utils , 'readDataFile' , ( version ) =>
52+ version === '3.0.1'
53+ ? '\n # comment\n0000;007F;Basic Latin # ASCII; block\n'
54+ : '\n # comment\n0000..007F;Basic Latin # ASCII; block\n' ,
55+ ) ;
56+ for ( const version of [ '3.0.1' , '18.0.0' ] ) {
57+ const map = await parseBlocks ( version ) ;
58+ t . assert . deepEqual ( Object . keys ( map ) , [ 'Basic_Latin' ] ) ;
59+ t . assert . ok ( map . Basic_Latin . contains ( 0 ) ) ;
60+ t . assert . ok ( map . Basic_Latin . contains ( 0x7f ) ) ;
61+ t . assert . ok ( ! map . Basic_Latin . contains ( 0x80 ) ) ;
62+ }
63+ } ) ;
64+
65+ test ( 'Name aliases ignore inline comments without splitting alias groups' , async ( t ) => {
66+ t . mock . method (
67+ utils ,
68+ 'readDataFile' ,
69+ ( ) => `
70+ # comment
71+ 000A;LINE FEED;control # note; still a comment
72+ 000A ; NEW LINE ; control
73+ 000A;LF;abbreviation # another name
74+ ` ,
75+ ) ;
76+ t . assert . deepEqual ( await parseNameAliases ( '18.0.0' ) , {
77+ control : { 10 : [ 'LINE FEED' , 'NEW LINE' ] } ,
78+ abbreviation : { 10 : [ 'LF' ] } ,
79+ } ) ;
80+ } ) ;
81+
3182test ( 'Emoji properties accept compact and padded field separators' , async ( t ) => {
3283 let source ;
3384 t . mock . method ( utils , 'readDataFile' , ( ) => source ) ;
0 commit comments