We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21cd789 commit b1bbbbbCopy full SHA for b1bbbbb
test/utils.js
@@ -9,6 +9,9 @@ import {
9
isSIP,
10
isTIP,
11
isSSP,
12
+ isHighSurrogate,
13
+ isLowSurrogate,
14
+ surrogatePairToCodePoint,
15
} from 'unicode-segmenter/utils';
16
17
fc.configureGlobal({
@@ -17,6 +20,25 @@ fc.configureGlobal({
20
numRuns: 100_000,
18
21
});
19
22
23
+test('surrogate pairs', () => {
24
+ fc.assert(
25
+ fc.property(
26
+ fc.integer({ min: 0xffff + 1, max: 0xeffff }),
27
+ // @ts-ignore
28
+ cp => {
29
+ let ch = String.fromCodePoint(cp);
30
+ let hi = ch.charCodeAt(0);
31
+ let lo = ch.charCodeAt(1);
32
+ return (
33
+ isHighSurrogate(hi) &&
34
+ isLowSurrogate(lo) &&
35
+ cp === surrogatePairToCodePoint(hi, lo)
36
+ );
37
+ }
38
+ )
39
40
+});
41
+
42
test('isBMP', () => {
43
fc.assert(
44
fc.property(
0 commit comments