Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/markdown-language-features/src/test/urlToUri.test.ts
3292 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 { deepStrictEqual } from 'assert';
7
import 'mocha';
8
import { Uri } from 'vscode';
9
import { urlToUri } from '../util/url';
10
11
suite('urlToUri', () => {
12
test('Absolute File', () => {
13
deepStrictEqual(
14
urlToUri('file:///root/test.txt', Uri.parse('file:///usr/home/')),
15
Uri.parse('file:///root/test.txt')
16
);
17
});
18
19
test('Relative File', () => {
20
deepStrictEqual(
21
urlToUri('./file.ext', Uri.parse('file:///usr/home/')),
22
Uri.parse('file:///usr/home/file.ext')
23
);
24
});
25
26
test('Http Basic', () => {
27
deepStrictEqual(
28
urlToUri('http://example.org?q=10&f', Uri.parse('file:///usr/home/')),
29
Uri.parse('http://example.org?q=10&f')
30
);
31
});
32
33
test('Http Encoded Chars', () => {
34
deepStrictEqual(
35
urlToUri('http://example.org/%C3%A4', Uri.parse('file:///usr/home/')),
36
Uri.parse('http://example.org/%C3%A4')
37
);
38
});
39
});
40
41