mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 01:25:38 -05:00
Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)
* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c * remove files we don't want * fix hygiene * update distro * update distro * fix hygiene * fix strict nulls * distro * distro * fix tests * fix tests * add another edit * fix viewlet icon * fix azure dialog * fix some padding * fix more padding issues
This commit is contained in:
@@ -458,4 +458,42 @@ suite('Strings', () => {
|
||||
assert.equal(strings.removeAccents('ñice'), 'nice');
|
||||
assert.equal(strings.removeAccents('ńice'), 'nice');
|
||||
});
|
||||
|
||||
test('encodeUTF8', function () {
|
||||
function assertEncodeUTF8(str: string, expected: number[]): void {
|
||||
const actual = strings.encodeUTF8(str);
|
||||
const actualArr: number[] = [];
|
||||
for (let offset = 0; offset < actual.byteLength; offset++) {
|
||||
actualArr[offset] = actual[offset];
|
||||
}
|
||||
assert.deepEqual(actualArr, expected);
|
||||
}
|
||||
|
||||
function assertDecodeUTF8(data: number[], expected: string): void {
|
||||
const actual = strings.decodeUTF8(new Uint8Array(data));
|
||||
assert.deepEqual(actual, expected);
|
||||
}
|
||||
|
||||
function assertEncodeDecodeUTF8(str: string, buff: number[]): void {
|
||||
assertEncodeUTF8(str, buff);
|
||||
assertDecodeUTF8(buff, str);
|
||||
}
|
||||
|
||||
assertEncodeDecodeUTF8('\u0000', [0]);
|
||||
assertEncodeDecodeUTF8('!', [33]);
|
||||
assertEncodeDecodeUTF8('\u007F', [127]);
|
||||
assertEncodeDecodeUTF8('\u0080', [194, 128]);
|
||||
assertEncodeDecodeUTF8('Ɲ', [198, 157]);
|
||||
assertEncodeDecodeUTF8('\u07FF', [223, 191]);
|
||||
assertEncodeDecodeUTF8('\u0800', [224, 160, 128]);
|
||||
assertEncodeDecodeUTF8('ஂ', [224, 174, 130]);
|
||||
assertEncodeDecodeUTF8('\uffff', [239, 191, 191]);
|
||||
assertEncodeDecodeUTF8('\u10000', [225, 128, 128, 48]);
|
||||
assertEncodeDecodeUTF8('🧝', [240, 159, 167, 157]);
|
||||
|
||||
});
|
||||
|
||||
test('getGraphemeBreakType', () => {
|
||||
assert.equal(strings.getGraphemeBreakType(0xBC1), strings.GraphemeBreakType.SpacingMark);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user