Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Apr 20, 2020
1 parent f7f3ade commit e65ec36
Show file tree
Hide file tree
Showing 3 changed files with 360 additions and 42 deletions.
12 changes: 7 additions & 5 deletions src/client/interpreter/configuration/interpreterSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import {
IInterpreterComparer,
IInterpreterQuickPickItem,
IInterpreterSelector,
InterpreterStateArgs,
IPythonPathUpdaterServiceManager
} from './types';

type InterpreterStateArgs = { path?: string; workspace: Resource };
@injectable()
export class InterpreterSelector implements IInterpreterSelector {
private disposables: Disposable[] = [];
Expand Down Expand Up @@ -105,10 +105,10 @@ export class InterpreterSelector implements IInterpreterSelector {

if (selection === undefined) {
return;
} else if (selection !== enterInterpreterPathSuggestion) {
state.path = (selection as IInterpreterQuickPickItem).path;
} else if (selection.label === enterInterpreterPathSuggestion.label) {
return this._enterOrBrowseInterpreterPath(input, state);
} else {
return this._enterOrBrowseInterpreterPath.bind(this);
state.path = (selection as IInterpreterQuickPickItem).path;
}
}

Expand All @@ -129,7 +129,9 @@ export class InterpreterSelector implements IInterpreterSelector {
acceptFilterBoxTextAsSelection: true
});

if (typeof selection === 'string') {
if (selection === undefined) {
return;
} else if (typeof selection === 'string') {
// User entered text in the filter box to enter path to python, store it
state.path = selection;
} else if (selection.label === 'Browse...') {
Expand Down
2 changes: 2 additions & 0 deletions src/client/interpreter/configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ export const IInterpreterComparer = Symbol('IInterpreterComparer');
export interface IInterpreterComparer {
compare(a: PythonInterpreter, b: PythonInterpreter): number;
}

export type InterpreterStateArgs = { path?: string; workspace: Resource };
Loading

0 comments on commit e65ec36

Please sign in to comment.