Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/test/common/services/unicodeTextModelHighlighter.test.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import assert from 'assert';
7
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';
8
import { Range } from '../../../common/core/range.js';
9
import { UnicodeHighlighterOptions, UnicodeTextModelHighlighter } from '../../../common/services/unicodeTextModelHighlighter.js';
10
import { createTextModel } from '../testTextModel.js';
11
12
suite('UnicodeTextModelHighlighter', () => {
13
ensureNoDisposablesAreLeakedInTestSuite();
14
15
function t(text: string, options: UnicodeHighlighterOptions): unknown {
16
const m = createTextModel(text);
17
const r = UnicodeTextModelHighlighter.computeUnicodeHighlights(m, options);
18
m.dispose();
19
20
return {
21
...r,
22
ranges: r.ranges.map(r => Range.lift(r).toString())
23
};
24
}
25
26
test('computeUnicodeHighlights (#168068)', () => {
27
assert.deepStrictEqual(
28
t(`
29
For å gi et eksempel
30
`, {
31
allowedCodePoints: [],
32
allowedLocales: [],
33
ambiguousCharacters: true,
34
invisibleCharacters: true,
35
includeComments: false,
36
includeStrings: false,
37
nonBasicASCII: false
38
}),
39
{
40
ambiguousCharacterCount: 0,
41
hasMore: false,
42
invisibleCharacterCount: 4,
43
nonBasicAsciiCharacterCount: 0,
44
ranges: [
45
'[2,5 -> 2,6]',
46
'[2,7 -> 2,8]',
47
'[2,10 -> 2,11]',
48
'[2,13 -> 2,14]'
49
]
50
}
51
);
52
});
53
});
54
55