Skip to content

Commit

Permalink
Strict null supressions in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed Feb 12, 2019
1 parent 14e4835 commit ebff3af
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape {
this._configurationListener.dispose();
}

$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resourceUriComponenets: UriComponents): Promise<void> {
$updateConfigurationOption(target: ConfigurationTarget | null, key: string, value: any, resourceUriComponenets: UriComponents | null): Promise<void> {
const resource = resourceUriComponenets ? URI.revive(resourceUriComponenets) : null;
return this.writeConfiguration(target, key, value, resource);
}

$removeConfigurationOption(target: ConfigurationTarget, key: string, resourceUriComponenets: UriComponents): Promise<void> {
$removeConfigurationOption(target: ConfigurationTarget | null, key: string, resourceUriComponenets: UriComponents | null): Promise<void> {
const resource = resourceUriComponenets ? URI.revive(resourceUriComponenets) : null;
return this.writeConfiguration(target, key, undefined, resource);
}

private writeConfiguration(target: ConfigurationTarget, key: string, value: any, resource: URI | null): Promise<void> {
private writeConfiguration(target: ConfigurationTarget | null, key: string, value: any, resource: URI | null): Promise<void> {
target = target !== null && target !== undefined ? target : this.deriveConfigurationTarget(key, resource);
return this.configurationService.updateValue(key, value, { resource }, target, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ suite('Debug - Base Debug View', () => {
test('render variable', () => {
const session = new MockSession();
const thread = new Thread(session, 'mockthread', 1);
const stackFrame = new StackFrame(thread, 1, null, 'app.js', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: undefined, endColumn: undefined }, 0);
const stackFrame = new StackFrame(thread, 1, null!, 'app.js', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: undefined!, endColumn: undefined! }, 0);
const scope = new Scope(stackFrame, 1, 'local', 1, false, 10, 10);

let variable = new Variable(session, scope, 2, 'foo', 'bar.foo', undefined, 0, 0, {}, 'string');
let variable = new Variable(session, scope, 2, 'foo', 'bar.foo', undefined!, 0, 0, {}, 'string');
let expression = $('.');
let name = $('.');
let value = $('.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ suite('Debug - Link Detector', () => {

assert.equal(1, output.children.length);
assert.equal('SPAN', output.tagName);
assert.equal('A', output.firstElementChild.tagName);
assert.equal('A', output.firstElementChild!.tagName);
assert(expectedOutput.test(output.outerHTML));
assertElementIsLink(output.firstElementChild);
assert.equal(isWindows ? 'C:/foo/bar.js:12:34' : '/Users/foo/bar.js:12:34', output.firstElementChild.textContent);
assertElementIsLink(output.firstElementChild!);
assert.equal(isWindows ? 'C:/foo/bar.js:12:34' : '/Users/foo/bar.js:12:34', output.firstElementChild!.textContent);
});

test('relativeLink', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/services/panel/common/panelService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface IPanelService {
/**
* Returns the current active panel or null if none
*/
getActivePanel(): IPanel;
getActivePanel(): IPanel | null;

/**
* * Returns all built-in panels following the default order (Problems - Output - Debug Console - Terminal)
Expand Down
142 changes: 71 additions & 71 deletions src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ suite('MainThreadDocumentsAndEditors', () => {
let deltas: IDocumentsAndEditorsDelta[] = [];
const hugeModelString = new Array(2 + (50 * 1024 * 1024)).join('-');

function myCreateTestCodeEditor(model: ITextModel): TestCodeEditor {
function myCreateTestCodeEditor(model: ITextModel | undefined): TestCodeEditor {
return createTestCodeEditor({
model: model,
serviceCollection: new ServiceCollection(
Expand Down Expand Up @@ -68,12 +68,12 @@ suite('MainThreadDocumentsAndEditors', () => {
textFileService,
workbenchEditorService,
codeEditorService,
null,
null!,
fileService,
null,
null,
null!,
null!,
editorGroupService,
null,
null!,
new class extends mock<IPanelService>() implements IPanelService {
_serviceBrand: any;
onDidPanelOpen = Event.None;
Expand All @@ -95,7 +95,7 @@ suite('MainThreadDocumentsAndEditors', () => {
assert.equal(deltas.length, 1);
const [delta] = deltas;

assert.equal(delta.addedDocuments.length, 1);
assert.equal(delta.addedDocuments!.length, 1);
assert.equal(delta.removedDocuments, undefined);
assert.equal(delta.addedEditors, undefined);
assert.equal(delta.removedEditors, undefined);
Expand Down Expand Up @@ -146,7 +146,7 @@ suite('MainThreadDocumentsAndEditors', () => {
});

test('ignore editor w/o model', () => {
const editor = myCreateTestCodeEditor(null);
const editor = myCreateTestCodeEditor(undefined);
assert.equal(deltas.length, 1);
const [delta] = deltas;
assert.equal(delta.newActiveEditor, null);
Expand All @@ -166,13 +166,13 @@ suite('MainThreadDocumentsAndEditors', () => {

assert.equal(deltas.length, 2);
const [first, second] = deltas;
assert.equal(first.addedDocuments.length, 1);
assert.equal(first.addedDocuments!.length, 1);
assert.equal(first.newActiveEditor, null);
assert.equal(first.removedDocuments, undefined);
assert.equal(first.addedEditors, undefined);
assert.equal(first.removedEditors, undefined);

assert.equal(second.addedEditors.length, 1);
assert.equal(second.addedEditors!.length, 1);
assert.equal(second.addedDocuments, undefined);
assert.equal(second.removedDocuments, undefined);
assert.equal(second.removedEditors, undefined);
Expand All @@ -194,8 +194,8 @@ suite('MainThreadDocumentsAndEditors', () => {
const [first] = deltas;

assert.equal(first.newActiveEditor, null);
assert.equal(first.removedEditors.length, 1);
assert.equal(first.removedDocuments.length, 1);
assert.equal(first.removedEditors!.length, 1);
assert.equal(first.removedDocuments!.length, 1);
assert.equal(first.addedDocuments, undefined);
assert.equal(first.addedEditors, undefined);

Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/test/workbenchTestServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IDecorationsService, IResourceDecorationChangeEvent, IDecoration, IDecorationData, IDecorationsProvider } from 'vs/workbench/services/decorations/browser/decorations';
import { IDisposable, toDisposable, Disposable } from 'vs/base/common/lifecycle';
import { IEditorGroupsService, IEditorGroup, GroupsOrder, GroupsArrangement, GroupDirection, IAddGroupOptions, IMergeGroupOptions, IMoveEditorOptions, ICopyEditorOptions, IEditorReplacement, IGroupChangeEvent, EditorsOrder, IFindGroupScope, EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService, IOpenEditorOverrideHandler } from 'vs/workbench/services/editor/common/editorService';
import { IEditorService, IOpenEditorOverrideHandler, IActiveEditor } from 'vs/workbench/services/editor/common/editorService';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { IDecorationRenderOptions } from 'vs/editor/common/editorCommon';
Expand Down Expand Up @@ -730,7 +730,7 @@ export class TestEditorService implements EditorServiceImpl {
onDidCloseEditor: Event<IEditorCloseEvent> = Event.None;
onDidOpenEditorFail: Event<IEditorIdentifier> = Event.None;

activeControl: IEditor;
activeControl: IActiveEditor;
activeTextEditorWidget: any;
activeEditor: IEditorInput;
editors: ReadonlyArray<IEditorInput> = [];
Expand Down

0 comments on commit ebff3af

Please sign in to comment.