@@ -2,6 +2,7 @@ import { test } from 'node:test';
22import fs from 'node:fs' ;
33import parseCaseFolding from '../scripts/parse-case-folding.mjs' ;
44import parseBidiClass from '../scripts/parse-bidi-class.mjs' ;
5+ import parseNames from '../scripts/parse-names.mjs' ;
56import utils from '../scripts/utils.mjs' ;
67import parseDecompositionMapping from '../scripts/parse-decomposition-mapping.mjs' ;
78import parseIndicConjunctBreak from '../scripts/parse-indic-conjunct-break.mjs' ;
@@ -26,6 +27,37 @@ test('Hangul has pairwise canonical decomposition mappings', async (t) => {
2627 t . assert . equal ( await parseDecompositionMapping ( '1.1.5' ) , undefined ) ;
2728} ) ;
2829
30+ test ( 'Algorithmic ranges have individual formal names' , async ( t ) => {
31+ for ( const version of [ '2.0.14' , '3.2.0' , '18.0.0' ] ) {
32+ const names = await parseNames ( version ) ;
33+ for ( const [ cp , name ] of [
34+ [ 0xac00 , 'HANGUL SYLLABLE GA' ] ,
35+ [ 0xac01 , 'HANGUL SYLLABLE GAG' ] ,
36+ [ 0xd7a3 , 'HANGUL SYLLABLE HIH' ] ,
37+ [ 0x4e00 , 'CJK UNIFIED IDEOGRAPH-4E00' ] ,
38+ [ 0xf900 , 'CJK COMPATIBILITY IDEOGRAPH-F900' ] ,
39+ ] ) {
40+ t . assert . ok ( names [ name ] ?. contains ( cp ) , `${ version } : ${ name } ` ) ;
41+ }
42+ t . assert . equal ( names [ 'Hangul Syllable' ] , undefined ) ;
43+ t . assert . equal ( names [ 'CJK Ideograph' ] , undefined ) ;
44+ t . assert . equal ( names [ 'Private Use' ] , undefined ) ;
45+ t . assert . equal ( names [ '<control>' ] , undefined ) ;
46+ }
47+ const names = await parseNames ( '18.0.0' ) ;
48+ for ( const [ cp , name ] of [
49+ [ 0x20000 , 'CJK UNIFIED IDEOGRAPH-20000' ] ,
50+ [ 0x17000 , 'TANGUT IDEOGRAPH-17000' ] ,
51+ [ 0x18d00 , 'TANGUT IDEOGRAPH-18D00' ] ,
52+ [ 0x18e00 , 'JURCHEN CHARACTER-18E00' ] ,
53+ [ 0x19191 , 'JURCHEN CHARACTER-19191' ] ,
54+ [ 0x3d000 , 'SMALL SEAL CHARACTER-3D000' ] ,
55+ [ 0x3fc3f , 'SMALL SEAL CHARACTER-3FC3F' ] ,
56+ ] ) {
57+ t . assert . ok ( names [ name ] ?. contains ( cp ) , name ) ;
58+ }
59+ } ) ;
60+
2961test ( 'Bidi class applies historical and current unassigned defaults' , async ( t ) => {
3062 for ( const version of [
3163 '3.0.0' ,
0 commit comments