mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
#17110 Move service test utils to workbench
This commit is contained in:
parent
c07a26c9a4
commit
cf385bcc10
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
@ -10,7 +10,7 @@
|
|||
"stopOnEntry": false,
|
||||
"args": [
|
||||
"--timeout",
|
||||
"999999"
|
||||
"3999"
|
||||
],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {
|
||||
|
|
|
@ -9,7 +9,7 @@ import URI from 'vs/base/common/uri';
|
|||
import { join } from 'vs/base/common/paths';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { EncodingMode } from 'vs/workbench/common/editor';
|
||||
import { IEventService } from 'vs/platform/event/common/event';
|
||||
|
|
|
@ -11,7 +11,7 @@ import URI from 'vs/base/common/uri';
|
|||
import { join, basename } from 'vs/base/common/paths';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { EditorStacksModel } from 'vs/workbench/common/editor/editorStacksModel';
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as assert from 'assert';
|
|||
import URI from 'vs/base/common/uri';
|
||||
import { isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||
import { OutputLinkComputer } from 'vs/workbench/parts/output/common/outputLinkComputer';
|
||||
import { TestContextService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestContextService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
|
||||
function toOSPath(p: string): string {
|
||||
if (isMacintosh || isLinux) {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { Match, FileMatch, FileMatchOrMatch } from 'vs/workbench/parts/search/co
|
|||
import { ReplaceAction } from 'vs/workbench/parts/search/browser/searchActions';
|
||||
import { ArrayNavigator } from 'vs/base/common/iterator';
|
||||
import { IFileMatch } from 'vs/platform/search/common/search';
|
||||
import { createMockModelService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { createMockModelService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
|
|
|
@ -10,7 +10,7 @@ import { Match, FileMatch, SearchResult } from 'vs/workbench/parts/search/common
|
|||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { SearchSorter, SearchDataSource } from 'vs/workbench/parts/search/browser/searchResultsView';
|
||||
import { IFileMatch, ILineMatch } from 'vs/platform/search/common/search';
|
||||
import { createMockModelService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { createMockModelService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
|
||||
suite('Search - Viewlet', () => {
|
||||
|
|
|
@ -15,8 +15,10 @@ import URI from 'vs/base/common/uri';
|
|||
import { IFileMatch, ILineMatch, ISearchService, ISearchComplete, ISearchProgressItem, IUncachedSearchStats } from 'vs/platform/search/common/search';
|
||||
import { ITelemetryService, NullTelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { createMockModelService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
|
||||
suite('SearchModel', () => {
|
||||
|
||||
|
@ -38,7 +40,7 @@ suite('SearchModel', () => {
|
|||
restoreStubs = [];
|
||||
instantiationService = new TestInstantiationService();
|
||||
instantiationService.stub(ITelemetryService, NullTelemetryService);
|
||||
instantiationService.stub(IModelService, createMockModelService(instantiationService));
|
||||
instantiationService.stub(IModelService, stubModelService(instantiationService));
|
||||
instantiationService.stub(ISearchService, {});
|
||||
instantiationService.stub(ISearchService, 'search', PPromise.as({ results: [] }));
|
||||
});
|
||||
|
@ -285,4 +287,9 @@ suite('SearchModel', () => {
|
|||
return stub;
|
||||
}
|
||||
|
||||
function stubModelService(instantiationService: TestInstantiationService): IModelService {
|
||||
instantiationService.stub(IConfigurationService, new TestConfigurationService());
|
||||
return instantiationService.createInstance(ModelServiceImpl);
|
||||
}
|
||||
|
||||
});
|
|
@ -12,7 +12,9 @@ import URI from 'vs/base/common/uri';
|
|||
import { IFileMatch, ILineMatch } from 'vs/platform/search/common/search';
|
||||
import { ITelemetryService, NullTelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { createMockModelService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IReplaceService } from 'vs/workbench/parts/search/common/replace';
|
||||
|
||||
|
@ -23,7 +25,7 @@ suite('SearchResult', () => {
|
|||
setup(() => {
|
||||
instantiationService = new TestInstantiationService();
|
||||
instantiationService.stub(ITelemetryService, NullTelemetryService);
|
||||
instantiationService.stub(IModelService, createMockModelService(instantiationService));
|
||||
instantiationService.stub(IModelService, stubModelService(instantiationService));
|
||||
instantiationService.stubPromise(IReplaceService, {});
|
||||
instantiationService.stubPromise(IReplaceService, 'replace', null);
|
||||
});
|
||||
|
@ -375,4 +377,9 @@ suite('SearchResult', () => {
|
|||
function aLineMatch(preview: string, lineNumber: number = 1, offsetAndLengths: number[][] = [[0, 1]]): ILineMatch {
|
||||
return { preview, lineNumber, offsetAndLengths };
|
||||
}
|
||||
|
||||
function stubModelService(instantiationService: TestInstantiationService): IModelService {
|
||||
instantiationService.stub(IConfigurationService, new TestConfigurationService());
|
||||
return instantiationService.createInstance(ModelServiceImpl);
|
||||
}
|
||||
});
|
|
@ -12,7 +12,7 @@ import { IStringDictionary } from 'vs/base/common/collections';
|
|||
import { IWorkspace } from 'vs/platform/workspace/common/workspace';
|
||||
import { TerminalInstance } from 'vs/workbench/parts/terminal/electron-browser/terminalInstance';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { TestMessageService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestMessageService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
|
||||
suite('Workbench - TerminalInstance', () => {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { parseArgs } from 'vs/platform/environment/node/argv';
|
|||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { IRawTextContent } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { TestWindowService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestWindowService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
class TestEnvironmentService extends EnvironmentService {
|
||||
|
||||
constructor(private _backupHome: string, private _backupWorkspacesPath: string) {
|
||||
|
|
|
@ -17,7 +17,7 @@ import { parseArgs } from 'vs/platform/environment/node/argv';
|
|||
import { WorkspaceContextService, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import extfs = require('vs/base/node/extfs');
|
||||
import { TestEventService, workbenchInstantiationService, TestTextFileService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestEventService, workbenchInstantiationService, TestTextFileService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import uuid = require('vs/base/common/uuid');
|
||||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { WorkspaceConfigurationService } from 'vs/workbench/services/configuration/node/configurationService';
|
||||
|
|
|
@ -16,7 +16,7 @@ import { WorkspaceContextService } from 'vs/platform/workspace/common/workspace'
|
|||
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { parseArgs } from 'vs/platform/environment/node/argv';
|
||||
import extfs = require('vs/base/node/extfs');
|
||||
import { TestEventService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestEventService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import uuid = require('vs/base/common/uuid');
|
||||
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { WorkspaceConfigurationService } from 'vs/workbench/services/configuration/node/configurationService';
|
||||
|
|
|
@ -11,7 +11,7 @@ import { IConfigurationService, getConfigurationValue } from 'vs/platform/config
|
|||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
|
||||
import { ConfigurationResolverService } from 'vs/workbench/services/configurationResolver/node/configurationResolverService';
|
||||
import { TestEnvironmentService, TestEditorService, } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestEnvironmentService, TestEditorService, } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
|
||||
suite('Configuration Resolver Service', () => {
|
||||
|
|
|
@ -12,7 +12,7 @@ import { EncodingMode } from 'vs/workbench/common/editor';
|
|||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
import { IEventService } from 'vs/platform/event/common/event';
|
||||
import { ITextFileService, ModelState, StateChange } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { workbenchInstantiationService, TestTextFileService, createFileInput } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService, TestTextFileService, createFileInput } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { onError, toResource } from 'vs/base/test/common/utils';
|
||||
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
|
||||
import { FileOperationResult, IFileOperationResult } from 'vs/platform/files/common/files';
|
||||
|
|
|
@ -11,7 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
|||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
|
||||
import { join, basename } from 'vs/base/common/paths';
|
||||
import { workbenchInstantiationService, TestEditorGroupService, createFileInput } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService, TestEditorGroupService, createFileInput } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { onError } from 'vs/base/test/common/utils';
|
||||
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as assert from 'assert';
|
||||
import { ILifecycleService, ShutdownEvent, ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { workbenchInstantiationService, TestLifecycleService, TestTextFileService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService, TestLifecycleService, TestTextFileService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { onError, toResource } from 'vs/base/test/common/utils';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
|
|
|
@ -12,7 +12,7 @@ import URI from 'vs/base/common/uri';
|
|||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { toResource } from 'vs/base/test/common/utils';
|
||||
import { ITextModelResolverService } from 'vs/editor/common/services/resolverService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as assert from 'assert';
|
|||
import { EditorStacksModel, EditorGroup, GroupEvent } from 'vs/workbench/common/editor/editorStacksModel';
|
||||
import { EditorInput, IFileEditorInput, IEditorIdentifier, IEditorGroup, IStacksModelChangeEvent, IEditorRegistry, Extensions as EditorExtensions, IEditorInputFactory } from 'vs/workbench/common/editor';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { TestStorageService, TestLifecycleService, TestContextService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestStorageService, TestLifecycleService, TestContextService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as assert from 'assert';
|
|||
import { Build, Builder } from 'vs/base/browser/builder';
|
||||
import { Part } from 'vs/workbench/browser/part';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
import * as TestUtils from 'vs/test/utils/servicesTestUtils';
|
||||
import * as TestUtils from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IWorkspaceContextService, WorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { StorageService, InMemoryLocalStorage } from 'vs/platform/storage/common/storageService';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import * as assert from 'assert';
|
||||
import 'vs/workbench/browser/parts/editor/editor.contribution'; // make sure to load all contributed editor things into tests
|
||||
import { TestQuickOpenService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestQuickOpenService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { Registry } from 'vs/platform/platform';
|
||||
import { QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenAction } from 'vs/workbench/browser/quickopen';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import { EditorInput, EditorOptions, TextEditorOptions } from 'vs/workbench/comm
|
|||
import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput';
|
||||
import { StringEditorModel } from 'vs/workbench/common/editor/stringEditorModel';
|
||||
import { FileEditorInput } from 'vs/workbench/parts/files/common/editors/fileEditorInput';
|
||||
import { workbenchInstantiationService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { Viewlet, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { IPanel } from 'vs/workbench/common/panel';
|
||||
import { WorkbenchProgressService, ScopedService } from 'vs/workbench/services/progress/browser/progressService';
|
||||
|
|
|
@ -15,7 +15,9 @@ import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput'
|
|||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
|
||||
import { createMockModelService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
|
||||
class MyEditorModel extends EditorModel { }
|
||||
class MyTextEditorModel extends BaseTextEditorModel { }
|
||||
|
@ -49,7 +51,7 @@ suite('Workbench - EditorModel', () => {
|
|||
});
|
||||
|
||||
test('BaseTextEditorModel', function (done) {
|
||||
let modelService = createMockModelService(instantiationService);
|
||||
let modelService = stubModelService(instantiationService);
|
||||
|
||||
let m = new MyTextEditorModel(modelService, modeService);
|
||||
m.load().then((model: any) => {
|
||||
|
@ -64,7 +66,7 @@ suite('Workbench - EditorModel', () => {
|
|||
});
|
||||
|
||||
test('TextDiffEditorModel', function (done) {
|
||||
instantiationService.stub(IModelService, createMockModelService(instantiationService));
|
||||
instantiationService.stub(IModelService, stubModelService(instantiationService));
|
||||
let input = instantiationService.createInstance(StringEditorInput, 'name', 'description', 'value', 'text/plain', false);
|
||||
let otherInput = instantiationService.createInstance(StringEditorInput, 'name2', 'description', 'value2', 'text/plain', false);
|
||||
let diffInput = new DiffEditorInput('name', 'description', input, otherInput);
|
||||
|
@ -88,4 +90,9 @@ suite('Workbench - EditorModel', () => {
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
function stubModelService(instantiationService: TestInstantiationService): IModelService {
|
||||
instantiationService.stub(IConfigurationService, new TestConfigurationService());
|
||||
return instantiationService.createInstance(ModelServiceImpl);
|
||||
}
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
import * as assert from 'assert';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { createMockModelService, TestEditorService, workbenchInstantiationService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestEditorService, workbenchInstantiationService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
|
||||
|
@ -21,6 +21,9 @@ import { TextModel } from 'vs/editor/common/model/textModel';
|
|||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Cursor } from 'vs/editor/common/controller/cursor';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
|
||||
suite('Editor - Range decorations', () => {
|
||||
|
||||
|
@ -39,7 +42,7 @@ suite('Editor - Range decorations', () => {
|
|||
instantiationService = <TestInstantiationService>workbenchInstantiationService();
|
||||
editorService = <WorkbenchEditorService.IWorkbenchEditorService>instantiationService.stub(WorkbenchEditorService.IWorkbenchEditorService, new TestEditorService(function () { }));
|
||||
modeService = instantiationService.stub(IModeService, ModeServiceImpl);
|
||||
modelService = <IModelService>instantiationService.stub(IModelService, createMockModelService(instantiationService));
|
||||
modelService = <IModelService>instantiationService.stub(IModelService, stubModelService(instantiationService));
|
||||
text = 'LINE1' + '\n' + 'LINE2' + '\n' + 'LINE3' + '\n' + 'LINE4' + '\r\n' + 'LINE5';
|
||||
model = aModel(URI.file('some_file'));
|
||||
codeEditor = mockCodeEditor([], { model });
|
||||
|
@ -166,4 +169,9 @@ suite('Editor - Range decorations', () => {
|
|||
rangeHighlights.sort(Range.compareRangesUsingStarts);
|
||||
return rangeHighlights;
|
||||
}
|
||||
|
||||
function stubModelService(instantiationService: TestInstantiationService): IModelService {
|
||||
instantiationService.stub(IConfigurationService, new TestConfigurationService());
|
||||
return instantiationService.createInstance(ModelServiceImpl);
|
||||
}
|
||||
});
|
|
@ -10,7 +10,7 @@ import URI from 'vs/base/common/uri';
|
|||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { workbenchInstantiationService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
|
||||
|
|
|
@ -10,7 +10,10 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
|||
import URI from 'vs/base/common/uri';
|
||||
import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { createMockModelService, TestEditorService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestEditorService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
|
||||
|
@ -27,7 +30,7 @@ suite('Workbench - StringEditorInput', () => {
|
|||
instantiationService = new TestInstantiationService();
|
||||
editorService = <WorkbenchEditorService.IWorkbenchEditorService>instantiationService.stub(WorkbenchEditorService.IWorkbenchEditorService, new TestEditorService(function () { }));
|
||||
modeService = instantiationService.stub(IModeService, ModeServiceImpl);
|
||||
modelService = <IModelService>instantiationService.stub(IModelService, createMockModelService(instantiationService));
|
||||
modelService = <IModelService>instantiationService.stub(IModelService, stubModelService(instantiationService));
|
||||
});
|
||||
|
||||
test('StringEditorInput', function (done) {
|
||||
|
@ -109,4 +112,9 @@ suite('Workbench - StringEditorInput', () => {
|
|||
assert.strictEqual(promiseEditorInput.matches(promiseEditorInput2), true);
|
||||
assert.strictEqual(stringEditorInput.matches(stringEditorInput2), true);
|
||||
});
|
||||
|
||||
function stubModelService(instantiationService: TestInstantiationService): IModelService {
|
||||
instantiationService.stub(IConfigurationService, new TestConfigurationService());
|
||||
return instantiationService.createInstance(ModelServiceImpl);
|
||||
}
|
||||
});
|
|
@ -11,7 +11,9 @@ import { StringEditorModel } from 'vs/workbench/common/editor/stringEditorModel'
|
|||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
|
||||
import { createMockModelService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ModelServiceImpl } from 'vs/editor/common/services/modelServiceImpl';
|
||||
|
||||
suite('Workbench - StringEditorModel', () => {
|
||||
|
||||
|
@ -23,7 +25,7 @@ suite('Workbench - StringEditorModel', () => {
|
|||
});
|
||||
|
||||
test('StringEditorModel', function (done) {
|
||||
instantiationService.stub(IModelService, createMockModelService(instantiationService));
|
||||
instantiationService.stub(IModelService, stubModelService(instantiationService));
|
||||
let m = instantiationService.createInstance(StringEditorModel, 'value', 'mode', null);
|
||||
m.load().then(model => {
|
||||
assert(model === m);
|
||||
|
@ -45,7 +47,7 @@ suite('Workbench - StringEditorModel', () => {
|
|||
});
|
||||
|
||||
test('StringEditorModel - setValue, clearValue, append, trim', function (done) {
|
||||
instantiationService.stub(IModelService, createMockModelService(instantiationService));
|
||||
instantiationService.stub(IModelService, stubModelService(instantiationService));
|
||||
let m = instantiationService.createInstance(StringEditorModel, 'value', 'mode', null);
|
||||
m.load().then(model => {
|
||||
assert(model === m);
|
||||
|
@ -79,4 +81,9 @@ suite('Workbench - StringEditorModel', () => {
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
function stubModelService(instantiationService: TestInstantiationService): IModelService {
|
||||
instantiationService.stub(IConfigurationService, new TestConfigurationService());
|
||||
return instantiationService.createInstance(ModelServiceImpl);
|
||||
}
|
||||
});
|
|
@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
|||
import { join } from 'vs/base/common/paths';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { workbenchInstantiationService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { UntitledEditorModel } from 'vs/workbench/common/editor/untitledEditorModel';
|
||||
|
||||
class ServiceAccessor {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import * as assert from 'assert';
|
||||
import { WorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import * as TestUtils from 'vs/test/utils/servicesTestUtils';
|
||||
import * as TestUtils from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { Memento, Scope } from 'vs/workbench/common/memento';
|
||||
import { StorageService, InMemoryLocalStorage } from 'vs/platform/storage/common/storageService';
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import { QuickOpenHandler, IQuickOpenRegistry, Extensions } from 'vs/workbench/b
|
|||
import { Registry } from 'vs/platform/platform';
|
||||
import { SearchService } from 'vs/workbench/services/search/node/searchService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { TestEnvironmentService, TestEditorService, TestEditorGroupService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestEnvironmentService, TestEditorService, TestEditorGroupService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import * as Timer from 'vs/base/common/timer';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
|
|
@ -19,7 +19,7 @@ import * as minimist from 'minimist';
|
|||
import * as path from 'path';
|
||||
import { SearchService } from 'vs/workbench/services/search/node/searchService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { TestEnvironmentService, TestEditorService, TestEditorGroupService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { TestEnvironmentService, TestEditorService, TestEditorGroupService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import URI from 'vs/base/common/uri';
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as assert from 'assert';
|
|||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FinalNewLineParticipant } from 'vs/workbench/api/node/mainThreadSaveParticipant';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/test/utils/servicesTestUtils';
|
||||
import { workbenchInstantiationService, TestTextFileService } from 'vs/workbench/test/workbenchTestUtils';
|
||||
import { toResource } from 'vs/base/test/common/utils';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
|
|
Loading…
Reference in a new issue