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