From 62eed25cd89c4c85f240b7108e1dfc627ab0757c Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Mon, 15 Oct 2018 16:47:43 +0200 Subject: [PATCH] Fix tests --- .../test/common/services/modelService.test.ts | 8 ++++---- .../test/common/testConfigurationService.ts | 17 ++++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/vs/editor/test/common/services/modelService.test.ts b/src/vs/editor/test/common/services/modelService.test.ts index 101c1bae952..38c8bdaf3a6 100644 --- a/src/vs/editor/test/common/services/modelService.test.ts +++ b/src/vs/editor/test/common/services/modelService.test.ts @@ -35,12 +35,12 @@ suite('ModelService', () => { test('EOL setting respected depending on root', () => { const model1 = modelService.createModel('farboo', null, null); - // const model2 = modelService.createModel('farboo', null, URI.file(platform.isWindows ? 'c:\\myroot\\myfile.txt' : '/myroot/myfile.txt')); - // const model3 = modelService.createModel('farboo', null, URI.file(platform.isWindows ? 'c:\\other\\myfile.txt' : '/other/myfile.txt')); + const model2 = modelService.createModel('farboo', null, URI.file(platform.isWindows ? 'c:\\myroot\\myfile.txt' : '/myroot/myfile.txt')); + const model3 = modelService.createModel('farboo', null, URI.file(platform.isWindows ? 'c:\\other\\myfile.txt' : '/other/myfile.txt')); assert.equal(model1.getOptions().defaultEOL, DefaultEndOfLine.LF); - // assert.equal(model2.getOptions().defaultEOL, DefaultEndOfLine.CRLF); - // assert.equal(model3.getOptions().defaultEOL, DefaultEndOfLine.LF); + assert.equal(model2.getOptions().defaultEOL, DefaultEndOfLine.CRLF); + assert.equal(model3.getOptions().defaultEOL, DefaultEndOfLine.LF); }); test('_computeEdits no change', function () { diff --git a/src/vs/platform/configuration/test/common/testConfigurationService.ts b/src/vs/platform/configuration/test/common/testConfigurationService.ts index c2ecae0e686..10a3e346316 100644 --- a/src/vs/platform/configuration/test/common/testConfigurationService.ts +++ b/src/vs/platform/configuration/test/common/testConfigurationService.ts @@ -19,15 +19,18 @@ export class TestConfigurationService implements IConfigurationService { } public getValue(arg1?: any, arg2?: any): any { - if (arg1 && typeof arg1 === 'string') { - return this.inspect(arg1).value; - } + let configuration; const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : void 0; - if (overrides && overrides.resource) { - const configForResource = this.configurationByRoot.findSubstr(overrides.resource.fsPath); - return configForResource || this.configuration; + if (overrides) { + if (overrides.resource) { + configuration = this.configurationByRoot.findSubstr(overrides.resource.fsPath); + } + } + configuration = configuration ? configuration : this.configuration; + if (arg1 && typeof arg1 === 'string') { + return getConfigurationValue(configuration, arg1); } - return this.configuration; + return configuration; } public updateValue(key: string, overrides?: IConfigurationOverrides): Promise { -- GitLab