Skip to content

Commit c98e18d

Browse files
committed
more tests
1 parent 0a07887 commit c98e18d

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/client/common/utils/localize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export namespace AttachProcess {
9292

9393
export namespace Repl {
9494
export const disableSmartSend = l10n.t('Disable Smart Send');
95+
export const launchNativeRepl = l10n.t('Launch VS Code Native REPL');
9596
}
9697
export namespace Pylance {
9798
export const remindMeLater = l10n.t('Remind me later');

src/client/terminals/pythonStartupLinkProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import {
66
TerminalLink,
77
TerminalLinkContext,
88
TerminalLinkProvider,
9-
l10n,
109
} from 'vscode';
1110
import { executeCommand } from '../common/vscodeApis/commandApis';
1211
import { registerTerminalLinkProvider } from '../common/vscodeApis/windowApis';
12+
import { Repl } from '../common/utils/localize';
1313

1414
interface CustomTerminalLink extends TerminalLink {
1515
command: string;
@@ -27,7 +27,7 @@ export class CustomTerminalLinkProvider implements TerminalLinkProvider<CustomTe
2727
links.push({
2828
startIndex: context.line.indexOf(expectedNativeLink),
2929
length: expectedNativeLink.length,
30-
tooltip: l10n.t('Launch VS Code Native REPL'),
30+
tooltip: Repl.launchNativeRepl,
3131
command: 'python.startNativeREPL',
3232
});
3333
}

src/test/terminals/shellIntegration/pythonStartup.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { registerPythonStartup } from '../../../client/terminals/pythonStartup';
1919
import { IExtensionContext } from '../../../client/common/types';
2020
import * as pythonStartupLinkProvider from '../../../client/terminals/pythonStartupLinkProvider';
2121
import { CustomTerminalLinkProvider } from '../../../client/terminals/pythonStartupLinkProvider';
22+
import { Repl } from '../../../client/common/utils/localize';
2223

2324
suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
2425
let getConfigurationStub: sinon.SinonStub;
@@ -163,5 +164,17 @@ suite('Terminal - Shell Integration with PYTHONSTARTUP', () => {
163164

164165
assert.isNotNull(links, 'Expected links to be not undefined');
165166
assert.isArray(links, 'Expected links to be an array');
167+
assert.isNotEmpty(links, 'Expected links to be not empty');
168+
169+
if (Array.isArray(links)) {
170+
assert.equal(links[0].command, 'python.startNativeREPL', 'Expected command to be python.startNativeREPL');
171+
assert.equal(
172+
links[0].startIndex,
173+
context.line.indexOf('VS Code Native REPL'),
174+
'Expected startIndex to be 0',
175+
);
176+
assert.equal(links[0].length, 'VS Code Native REPL'.length, 'Expected length to be 16');
177+
assert.equal(links[0].tooltip, Repl.launchNativeRepl, 'Expected tooltip to be Launch VS Code Native REPL');
178+
}
166179
});
167180
});

0 commit comments

Comments
 (0)