diff --git a/src/vs/workbench/test/node/api/extHostDiagnostics.test.ts b/src/vs/workbench/test/node/api/extHostDiagnostics.test.ts index 9f7725fe1f1fb8c13cbfa0a3a313ceab6082d69e..ab1dd37b04133ca18512e3786e2f799169febc95 100644 --- a/src/vs/workbench/test/node/api/extHostDiagnostics.test.ts +++ b/src/vs/workbench/test/node/api/extHostDiagnostics.test.ts @@ -8,7 +8,7 @@ import * as assert from 'assert'; import URI from 'vs/base/common/uri'; import {DiagnosticCollection} from 'vs/workbench/api/node/extHostDiagnostics'; -import {Diagnostic, Range, DiagnosticSeverity} from 'vs/workbench/api/node/extHostTypes'; +import {Diagnostic, Range} from 'vs/workbench/api/node/extHostTypes'; import {MainThreadDiagnosticsShape} from 'vs/workbench/api/node/extHost.protocol'; import {TPromise} from 'vs/base/common/winjs.base'; import {IMarkerData} from 'vs/platform/markers/common/markers'; @@ -159,4 +159,20 @@ suite('ExtHostDiagnostics', () => { }); + test('diagnostic capping', function () { + + let lastEntries: [URI, IMarkerData[]][]; + let collection = new DiagnosticCollection('test', new class extends DiagnosticsShape { + $changeMany(owner: string, entries: [URI, IMarkerData[]][]): TPromise { + lastEntries = entries; + return super.$changeMany(owner, entries); + } + }); + let uri = URI.parse('aa:bb'); + + collection.set(uri, new Array(500).map((value, i) => new Diagnostic(new Range(i, 0, i + 1, 0), `error#${i}`))); + assert.equal(collection.get(uri).length, 500); + assert.equal(lastEntries.length, 1); + assert.equal(lastEntries[0][1].length, 250); + }); }); \ No newline at end of file