Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more ensureNoDisposablesAreLeakedInTestSuite #202292

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,10 @@
// Files should (only) be removed from the list they adopt the leak detector
"exclude": [
"src/vs/base/test/browser/browser.test.ts",
"src/vs/base/test/browser/comparers.test.ts",
"src/vs/base/test/browser/hash.test.ts",
"src/vs/base/test/browser/ui/scrollbar/scrollableElement.test.ts",
"src/vs/base/test/browser/ui/scrollbar/scrollbarState.test.ts",
"src/vs/editor/contrib/codeAction/test/browser/codeActionKeybindingResolver.test.ts",
"src/vs/editor/contrib/codeAction/test/browser/codeActionModel.test.ts",
"src/vs/editor/contrib/dropOrPasteInto/test/browser/editSort.test.ts",
"src/vs/editor/contrib/gotoSymbol/test/browser/referencesModel.test.ts",
"src/vs/editor/contrib/smartSelect/test/browser/smartSelect.test.ts",
"src/vs/editor/contrib/snippet/test/browser/snippetParser.test.ts",
Expand All @@ -173,7 +170,6 @@
"src/vs/platform/contextkey/test/common/scanner.test.ts",
"src/vs/platform/extensions/test/common/extensionValidator.test.ts",
"src/vs/platform/instantiation/test/common/graph.test.ts",
"src/vs/platform/instantiation/test/common/instantiationService.test.ts",
"src/vs/platform/keybinding/test/common/abstractKeybindingService.test.ts",
"src/vs/platform/keybinding/test/common/keybindingLabels.test.ts",
"src/vs/platform/keybinding/test/common/keybindingResolver.test.ts",
Expand All @@ -188,7 +184,6 @@
"src/vs/workbench/api/test/browser/extHostApiCommands.test.ts",
"src/vs/workbench/api/test/browser/extHostBulkEdits.test.ts",
"src/vs/workbench/api/test/browser/extHostDocumentSaveParticipant.test.ts",
"src/vs/workbench/api/test/browser/extHostTextEditor.test.ts",
"src/vs/workbench/api/test/browser/extHostTypeConverter.test.ts",
"src/vs/workbench/api/test/browser/extHostWorkspace.test.ts",
"src/vs/workbench/api/test/browser/mainThreadConfiguration.test.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/vs/base/test/browser/comparers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as assert from 'assert';
import {
compareFileExtensions, compareFileExtensionsDefault, compareFileExtensionsLower, compareFileExtensionsUnicode, compareFileExtensionsUpper, compareFileNames, compareFileNamesDefault, compareFileNamesLower, compareFileNamesUnicode, compareFileNamesUpper
} from 'vs/base/common/comparers';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';

const compareLocale = (a: string, b: string) => a.localeCompare(b);
const compareLocaleNumeric = (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true });
Expand Down Expand Up @@ -694,7 +695,7 @@ suite('Comparers', () => {
assert(compareFileExtensionsUnicode('txt.abc01', 'txt.abc1') < 0, 'extensions with equivalent numbers sort in unicode order');
assert(compareFileExtensionsUnicode('a.ext1', 'b.Ext1') < 0, 'if extensions with numbers are equal except for case, unicode full filenames should be compared');
assert(compareFileExtensionsUnicode('a.ext1', 'a.Ext1') > 0, 'if extensions with numbers are equal except for case, unicode full filenames should be compared');

});

ensureNoDisposablesAreLeakedInTestSuite();
});
3 changes: 3 additions & 0 deletions src/vs/base/test/browser/hash.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import * as assert from 'assert';
import { sha1Hex } from 'vs/base/browser/hash';
import { hash, StringSHA1 } from 'vs/base/common/hash';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';

suite('Hash', () => {
test('string', () => {
Expand Down Expand Up @@ -101,4 +102,6 @@ suite('Hash', () => {
test('sha1-4', () => {
return checkSHA1('hello', 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d');
});

ensureNoDisposablesAreLeakedInTestSuite();
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
import { DocumentOnDropEdit } from 'vs/editor/common/languages';
import { sortEditsByYieldTo } from 'vs/editor/contrib/dropOrPasteInto/browser/edit';

Expand All @@ -18,6 +19,7 @@ function createTestEdit(providerId: string, args?: Partial<DropEdit>): DropEdit
}

suite('sortEditsByYieldTo', () => {

test('Should noop for empty edits', () => {
const edits: DropEdit[] = [];

Expand Down Expand Up @@ -62,4 +64,6 @@ suite('sortEditsByYieldTo', () => {

assert.deepStrictEqual(sortEditsByYieldTo(edits).map(x => x.providerId), ['c', 'a', 'b']);
});

ensureNoDisposablesAreLeakedInTestSuite();
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import * as assert from 'assert';
import { Emitter, Event } from 'vs/base/common/event';
import { dispose } from 'vs/base/common/lifecycle';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { createDecorator, IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
Expand Down Expand Up @@ -653,4 +654,6 @@ suite('Instantiation Service', () => {
c.a.doIt();
assert.strictEqual(eventCount, 1);
});

ensureNoDisposablesAreLeakedInTestSuite();
});
16 changes: 10 additions & 6 deletions src/vs/workbench/api/test/browser/extHostTextEditor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { TextEditorLineNumbersStyle, Range } from 'vs/workbench/api/common/extHostTypes';
import { TextEditorCursorStyle, RenderLineNumbersType } from 'vs/editor/common/config/editorOptions';
import { MainThreadTextEditorsShape, IResolvedTextEditorConfiguration, ITextEditorConfigurationUpdate } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostTextEditorOptions, ExtHostTextEditor } from 'vs/workbench/api/common/extHostTextEditor';
import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData';
import { Lazy } from 'vs/base/common/lazy';
import { URI } from 'vs/base/common/uri';
import { mock } from 'vs/base/test/common/mock';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
import { RenderLineNumbersType, TextEditorCursorStyle } from 'vs/editor/common/config/editorOptions';
import { NullLogService } from 'vs/platform/log/common/log';
import { Lazy } from 'vs/base/common/lazy';
import { IResolvedTextEditorConfiguration, ITextEditorConfigurationUpdate, MainThreadTextEditorsShape } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData';
import { ExtHostTextEditor, ExtHostTextEditorOptions } from 'vs/workbench/api/common/extHostTextEditor';
import { Range, TextEditorLineNumbersStyle } from 'vs/workbench/api/common/extHostTypes';

suite('ExtHostTextEditor', () => {

Expand Down Expand Up @@ -59,6 +60,8 @@ suite('ExtHostTextEditor', () => {
await editor.value.edit(edit => { edit.delete(new Range(0, 0, 1, 1)); });
assert.strictEqual(applyCount, 2);
});

ensureNoDisposablesAreLeakedInTestSuite();
});

suite('ExtHostTextEditorOptions', () => {
Expand Down Expand Up @@ -513,4 +516,5 @@ suite('ExtHostTextEditorOptions', () => {
assert.deepStrictEqual(calls, [{ cursorStyle: TextEditorCursorStyle.Block, lineNumbers: RenderLineNumbersType.Relative }]);
});

ensureNoDisposablesAreLeakedInTestSuite();
});