Add multiple result link tests
parent
add324e5ab
commit
ae4a501a22
|
@ -76,4 +76,11 @@ suite('Workbench - TerminalWebLinkProvider', () => {
|
|||
await assertLink('POST|https://portal.azure.com|2019-12-05|', [{ range: [[6, 1], [29, 1]], text: 'https://portal.azure.com' }]);
|
||||
await assertLink('aa https://foo.bar/[this is foo site] aa', [{ range: [[5, 1], [38, 1]], text: 'https://foo.bar/[this is foo site]' }]);
|
||||
});
|
||||
|
||||
test('should support multiple link results', async () => {
|
||||
await assertLink('http://foo.bar http://bar.foo', [
|
||||
{ range: [[1, 1], [14, 1]], text: 'http://foo.bar' },
|
||||
{ range: [[16, 1], [29, 1]], text: 'http://bar.foo' }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -149,4 +149,11 @@ suite('Workbench - TerminalValidatedLocalLinkProvider', () => {
|
|||
await assertLink(`+++ b/foo/bar`, OperatingSystem.Linux, [{ text: 'foo/bar', range: [[7, 1], [13, 1]] }]);
|
||||
});
|
||||
});
|
||||
|
||||
test('should support multiple link results', async () => {
|
||||
await assertLink('./foo ./bar', OperatingSystem.Linux, [
|
||||
{ range: [[1, 1], [5, 1]], text: './foo' },
|
||||
{ range: [[7, 1], [11, 1]], text: './bar' }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@ suite('Workbench - TerminalWordLinkProvider', () => {
|
|||
instantiationService.stub(IConfigurationService, configurationService);
|
||||
});
|
||||
|
||||
async function assertLink2(text: string, expected: { text: string, range: [number, number][] }[]) {
|
||||
async function assertLink(text: string, expected: { text: string, range: [number, number][] }[]) {
|
||||
const xterm = new Terminal();
|
||||
const provider: TerminalWordLinkProvider = instantiationService.createInstance(TerminalWordLinkProvider, xterm, () => { }, () => { });
|
||||
|
||||
|
@ -47,28 +47,36 @@ suite('Workbench - TerminalWordLinkProvider', () => {
|
|||
|
||||
test('should link words as defined by wordSeparators', async () => {
|
||||
await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' ()[]' } });
|
||||
await assertLink2('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]);
|
||||
await assertLink2('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]);
|
||||
await assertLink2(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink2('(foo)', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink2('[foo]', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink2('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]);
|
||||
await assertLink('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]);
|
||||
await assertLink('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]);
|
||||
await assertLink(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink('(foo)', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink('[foo]', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]);
|
||||
|
||||
await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' ' } });
|
||||
await assertLink2('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]);
|
||||
await assertLink2(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink2('(foo)', [{ range: [[1, 1], [5, 1]], text: '(foo)' }]);
|
||||
await assertLink2('[foo]', [{ range: [[1, 1], [5, 1]], text: '[foo]' }]);
|
||||
await assertLink2('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]);
|
||||
await assertLink('foo', [{ range: [[1, 1], [3, 1]], text: 'foo' }]);
|
||||
await assertLink(' foo ', [{ range: [[2, 1], [4, 1]], text: 'foo' }]);
|
||||
await assertLink('(foo)', [{ range: [[1, 1], [5, 1]], text: '(foo)' }]);
|
||||
await assertLink('[foo]', [{ range: [[1, 1], [5, 1]], text: '[foo]' }]);
|
||||
await assertLink('{foo}', [{ range: [[1, 1], [5, 1]], text: '{foo}' }]);
|
||||
});
|
||||
|
||||
test('should support wide characters', async () => {
|
||||
await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' []' } });
|
||||
await assertLink2('aabbccdd.txt ', [{ range: [[1, 1], [12, 1]], text: 'aabbccdd.txt' }]);
|
||||
await assertLink2('我是学生.txt ', [{ range: [[1, 1], [12, 1]], text: '我是学生.txt' }]);
|
||||
await assertLink2(' aabbccdd.txt ', [{ range: [[2, 1], [13, 1]], text: 'aabbccdd.txt' }]);
|
||||
await assertLink2(' 我是学生.txt ', [{ range: [[2, 1], [13, 1]], text: '我是学生.txt' }]);
|
||||
await assertLink2(' [aabbccdd.txt] ', [{ range: [[3, 1], [14, 1]], text: 'aabbccdd.txt' }]);
|
||||
await assertLink2(' [我是学生.txt] ', [{ range: [[3, 1], [14, 1]], text: '我是学生.txt' }]);
|
||||
await assertLink('aabbccdd.txt ', [{ range: [[1, 1], [12, 1]], text: 'aabbccdd.txt' }]);
|
||||
await assertLink('我是学生.txt ', [{ range: [[1, 1], [12, 1]], text: '我是学生.txt' }]);
|
||||
await assertLink(' aabbccdd.txt ', [{ range: [[2, 1], [13, 1]], text: 'aabbccdd.txt' }]);
|
||||
await assertLink(' 我是学生.txt ', [{ range: [[2, 1], [13, 1]], text: '我是学生.txt' }]);
|
||||
await assertLink(' [aabbccdd.txt] ', [{ range: [[3, 1], [14, 1]], text: 'aabbccdd.txt' }]);
|
||||
await assertLink(' [我是学生.txt] ', [{ range: [[3, 1], [14, 1]], text: '我是学生.txt' }]);
|
||||
});
|
||||
|
||||
test('should support multiple link results', async () => {
|
||||
await configurationService.setUserConfiguration('terminal', { integrated: { wordSeparators: ' ' } });
|
||||
await assertLink('foo bar', [
|
||||
{ range: [[1, 1], [3, 1]], text: 'foo' },
|
||||
{ range: [[5, 1], [7, 1]], text: 'bar' }
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue