提交 ed0420e3 编写于 作者: I isidor

configuration resolver service tests: use mock line number

上级 a33f2a23
......@@ -18,10 +18,12 @@ suite('Configuration Resolver Service', () => {
let configurationResolverService: IConfigurationResolverService;
let envVariables: { [key: string]: string } = { key1: 'Value for Key1', key2: 'Value for Key2' };
let mockCommandService: MockCommandService;
let editorService: TestEditorService;
setup(() => {
mockCommandService = new MockCommandService();
configurationResolverService = new ConfigurationResolverService(uri.parse('file:///VSCode/workspaceLocation'), envVariables, new TestEditorService(), TestEnvironmentService, new TestConfigurationService(), mockCommandService);
editorService = new TestEditorService();
configurationResolverService = new ConfigurationResolverService(uri.parse('file:///VSCode/workspaceLocation'), envVariables, editorService, TestEnvironmentService, new TestConfigurationService(), mockCommandService);
});
teardown(() => {
......@@ -42,7 +44,7 @@ suite('Configuration Resolver Service', () => {
});
test('current selected line number', () => {
assert.strictEqual(configurationResolverService.resolve('abc ${lineNumber} xyz'), 'abc 15 xyz');
assert.strictEqual(configurationResolverService.resolve('abc ${lineNumber} xyz'), `abc ${editorService.mockLineNumber} xyz`);
});
test('substitute many', () => {
......
......@@ -468,11 +468,13 @@ export class TestEditorService implements IWorkbenchEditorService {
public activeEditorInput: IEditorInput;
public activeEditorOptions: IEditorOptions;
public activeEditorPosition: Position;
public mockLineNumber: number;
private callback: (method: string) => void;
constructor(callback?: (method: string) => void) {
this.callback = callback || ((s: string) => { });
this.mockLineNumber = 15;
}
public openEditors(inputs): Promise {
......@@ -505,7 +507,7 @@ export class TestEditorService implements IWorkbenchEditorService {
getId: () => { return null; },
getControl: () => {
return {
getSelection: () => { return { positionLineNumber: 15 }; }
getSelection: () => { return { positionLineNumber: this.mockLineNumber }; }
};
},
focus: () => { },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册