11import { test } from 'node:test' ;
22import parseSpecialCasing from '../scripts/parse-special-casing.mjs' ;
3+ import parseEmoji from '../scripts/parse-emoji.mjs' ;
4+ import parseEmojiSequences from '../scripts/parse-emoji-sequences.mjs' ;
5+ import parseBidiBrackets from '../scripts/parse-bidi-brackets.mjs' ;
36import utils from '../scripts/utils.mjs' ;
47
58test ( 'SpecialCasing accepts optional comments and flexible whitespace' , async ( t ) => {
@@ -25,6 +28,48 @@ FB00 ; FB00 ; 0046 0066 ; 0046 0046 ; # comment with # and ; characters
2528 ] ) ;
2629} ) ;
2730
31+ test ( 'Emoji properties accept compact and padded field separators' , async ( t ) => {
32+ let source ;
33+ t . mock . method ( utils , 'readDataFile' , ( ) => source ) ;
34+ for ( const separator of [ ';' , ' ; ' , '\t;\t' , ' ;\t' ] ) {
35+ source = ` # comment\n\t\n231A..231B${ separator } Emoji_Presentation # watches\n1F600${ separator } Emoji\n` ;
36+ const map = await parseEmoji ( '18.0.0' ) ;
37+ t . assert . deepEqual ( map . Emoji_Presentation , [ 0x231a , 0x231b ] ) ;
38+ t . assert . deepEqual ( map . Emoji , [ 0x1f600 ] ) ;
39+ }
40+ } ) ;
41+
42+ test ( 'Emoji sequences preserve property names with flexible field spacing' , async ( t ) => {
43+ const sources = {
44+ 'emoji-sequences' :
45+ '0023 FE0F\t20E3;Emoji_Keycap_Sequence; keycap\n231A..231B;Basic_Emoji; watches\n' ,
46+ 'emoji-zwj-sequences' :
47+ '1F469\t200D 1F4BB\t;\tEmoji_ZWJ_Sequence ; technologist\n' ,
48+ 'emoji-test' : '0023\tFE0F 20E3;fully-qualified # keycap\n' ,
49+ } ;
50+ t . mock . method ( utils , 'readDataFile' , ( version , type ) => sources [ type ] ) ;
51+ const map = await parseEmojiSequences ( '18.0.0' ) ;
52+ t . assert . deepEqual ( map . Emoji_Keycap_Sequence , [ '#\ufe0f\u20e3' ] ) ;
53+ t . assert . deepEqual ( map . Basic_Emoji , [ '\u231a' , '\u231b' ] ) ;
54+ t . assert . deepEqual ( map . Emoji_ZWJ_Sequence , [ '\u{1f469}\u200d\u{1f4bb}' ] ) ;
55+ t . assert . deepEqual ( map . Emoji_Test , [ '#\ufe0f\u20e3' ] ) ;
56+ t . assert . equal ( map . keycap , undefined ) ;
57+ } ) ;
58+
59+ test ( 'Bidi brackets do not depend on separator spacing' , async ( t ) => {
60+ let source ;
61+ t . mock . method ( utils , 'readDataFile' , ( ) => source ) ;
62+ for ( const separator of [ ';' , ' ; ' , '\t;\t' ] ) {
63+ source = ` # comment\n\t\n0028${ separator } 0029${ separator } o\n0029${ separator } 0028${ separator } c\n` ;
64+ const map = await parseBidiBrackets ( '18.0.0' ) ;
65+ t . assert . deepEqual ( map . Open . toArray ( ) , [ 0x28 ] ) ;
66+ t . assert . deepEqual ( map . Close . toArray ( ) , [ 0x29 ] ) ;
67+ t . assert . ok ( ! map . None . contains ( 0x28 ) ) ;
68+ t . assert . ok ( ! map . None . contains ( 0x29 ) ) ;
69+ t . assert . ok ( map . None . contains ( 0x41 ) ) ;
70+ }
71+ } ) ;
72+
2873test ( 'SpecialCasing preserves empty mappings and normalizes condition separators' , async ( t ) => {
2974 t . mock . method (
3075 utils ,
0 commit comments