Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonykim1 committed Jan 23, 2025
1 parent 0a07887 commit c98e18d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export namespace AttachProcess {

export namespace Repl {
export const disableSmartSend = l10n.t('Disable Smart Send');
export const launchNativeRepl = l10n.t('Launch VS Code Native REPL');
}
export namespace Pylance {
export const remindMeLater = l10n.t('Remind me later');
Expand Down
4 changes: 2 additions & 2 deletions src/client/terminals/pythonStartupLinkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
TerminalLink,
TerminalLinkContext,
TerminalLinkProvider,
l10n,
} from 'vscode';
import { executeCommand } from '../common/vscodeApis/commandApis';
import { registerTerminalLinkProvider } from '../common/vscodeApis/windowApis';
import { Repl } from '../common/utils/localize';

interface CustomTerminalLink extends TerminalLink {
command: string;
Expand All @@ -27,7 +27,7 @@ export class CustomTerminalLinkProvider implements TerminalLinkProvider<CustomTe
links.push({
startIndex: context.line.indexOf(expectedNativeLink),
length: expectedNativeLink.length,
tooltip: l10n.t('Launch VS Code Native REPL'),
tooltip: Repl.launchNativeRepl,
command: 'python.startNativeREPL',
});
}
Expand Down
13 changes: 13 additions & 0 deletions src/test/terminals/shellIntegration/pythonStartup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { registerPythonStartup } from '../../../client/terminals/pythonStartup';
import { IExtensionContext } from '../../../client/common/types';
import * as pythonStartupLinkProvider from '../../../client/terminals/pythonStartupLinkProvider';
import { CustomTerminalLinkProvider } from '../../../client/terminals/pythonStartupLinkProvider';
import { Repl } from '../../../client/common/utils/localize';

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

assert.isNotNull(links, 'Expected links to be not undefined');
assert.isArray(links, 'Expected links to be an array');
assert.isNotEmpty(links, 'Expected links to be not empty');

if (Array.isArray(links)) {
assert.equal(links[0].command, 'python.startNativeREPL', 'Expected command to be python.startNativeREPL');
assert.equal(
links[0].startIndex,
context.line.indexOf('VS Code Native REPL'),
'Expected startIndex to be 0',
);
assert.equal(links[0].length, 'VS Code Native REPL'.length, 'Expected length to be 16');
assert.equal(links[0].tooltip, Repl.launchNativeRepl, 'Expected tooltip to be Launch VS Code Native REPL');
}
});
});

0 comments on commit c98e18d

Please sign in to comment.