@@ -10,15 +10,35 @@ test('isIdentifierName', () => {
10
10
'should expose the public api'
11
11
)
12
12
13
- assert . ok ( start ( 'a' . charCodeAt ( 0 ) ) , 'should say `a` is a start code' )
14
- assert . ok ( start ( '_' . charCodeAt ( 0 ) ) , 'should say `_` is a start code' )
15
- assert . ok ( ! start ( '1' . charCodeAt ( 0 ) ) , 'should not say `1` is a start code' )
16
- assert . ok ( ! start ( '-' . charCodeAt ( 0 ) ) , 'should not say `-` is a start code' )
13
+ assert . ok (
14
+ ! start ( '' . codePointAt ( 0 ) ) ,
15
+ 'should not say `undefined` is a start code'
16
+ )
17
+ assert . ok ( start ( 'a' . codePointAt ( 0 ) ) , 'should say `a` is a start code' )
18
+ assert . ok ( start ( '_' . codePointAt ( 0 ) ) , 'should say `_` is a start code' )
19
+ assert . ok ( ! start ( '1' . codePointAt ( 0 ) ) , 'should not say `1` is a start code' )
20
+ assert . ok ( ! start ( '-' . codePointAt ( 0 ) ) , 'should not say `-` is a start code' )
21
+ assert . ok ( start ( 'ಠ' . codePointAt ( 0 ) ) , 'should say `ಠ` is a start code' )
22
+ assert . ok (
23
+ start ( 0x1_02_a7 ) ,
24
+ 'should say `0xd8_00 0xde_a7` (together 0x1_02_a7) is a start code'
25
+ )
26
+ assert . ok ( ! start ( 0xd8_00 ) , 'should not say `0xd8_00` is a start code' )
17
27
18
- assert . ok ( cont ( 'a' . charCodeAt ( 0 ) ) , 'should say `a` is a cont code' )
19
- assert . ok ( cont ( '_' . charCodeAt ( 0 ) ) , 'should say `_` is a cont code' )
20
- assert . ok ( cont ( '1' . charCodeAt ( 0 ) ) , 'should say `1` is a cont code' )
21
- assert . ok ( ! cont ( '-' . charCodeAt ( 0 ) ) , 'should not say `-` is a cont code' )
28
+ assert . ok (
29
+ ! cont ( '' . codePointAt ( 0 ) ) ,
30
+ 'should not say `undefined` is a cont code'
31
+ )
32
+ assert . ok ( cont ( 'a' . codePointAt ( 0 ) ) , 'should say `a` is a cont code' )
33
+ assert . ok ( cont ( '_' . codePointAt ( 0 ) ) , 'should say `_` is a cont code' )
34
+ assert . ok ( cont ( '1' . codePointAt ( 0 ) ) , 'should say `1` is a cont code' )
35
+ assert . ok ( ! cont ( '-' . codePointAt ( 0 ) ) , 'should not say `-` is a cont code' )
36
+ assert . ok ( cont ( 'ಠ' . codePointAt ( 0 ) ) , 'should say `ಠ` is a cont code' )
37
+ assert . ok (
38
+ cont ( 0x1_02_a7 ) ,
39
+ 'should say `0xd8_00 0xde_a7` (together 0x1_02_a7) is a cont code'
40
+ )
41
+ assert . ok ( ! cont ( 0xd8_00 ) , 'should not say `0xd8_00` is a cont code' )
22
42
23
43
assert . ok ( ! name ( '' ) , 'should not say `` (empty string) is a name' )
24
44
assert . ok ( name ( 'a' ) , 'should say `a` is a name' )
@@ -30,4 +50,6 @@ test('isIdentifierName', () => {
30
50
assert . ok ( name ( '_a$b9' ) , 'should say `_a$b9` is a name' )
31
51
assert . ok ( ! name ( 'aaa-' ) , 'should not say `aaa-` is a name' )
32
52
assert . ok ( ! name ( '-aaa' ) , 'should not say `-aaa` is a name' )
53
+ assert . ok ( name ( 'ಠ_ಠ' ) , 'should say `ಠ_ಠ` is a name' )
54
+ assert . ok ( name ( '𐊧' ) , 'should say `𐊧` (0x1_02_a7) is a name' )
33
55
} )
0 commit comments