Skip to content

Commit

Permalink
Fix intermittent failure in ANSIOutput test... (#4518)
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarenerd committed Aug 28, 2024
1 parent 5404728 commit f2238e0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/vs/base/test/common/ansiOutput.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as assert from 'assert';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
import { ANSIColor, ANSIFormat, ANSIOutput, ANSIStyle } from 'vs/base/common/ansiOutput';

//#region Test Helpers
Expand Down Expand Up @@ -453,7 +454,7 @@ const makeLines = (count: number): string[] => {
// Make the lines.
const lines: string[] = [];
for (let i = 0; i < count; i++) {
lines.push('0'.repeat(Math.floor(Math.random() * 1025)));
lines.push('0'.repeat(Math.floor(Math.random() * 1024) + (i === count - 1 ? 1 : 0)));
}

// Done.
Expand Down Expand Up @@ -1693,9 +1694,9 @@ suite('ANSIOutout', () => {

const testOutputLines = (count: number, terminator: string) => {
// Setup.
const lines = makeLines(10);
const lines = makeLines(count);
const ansiOutput = new ANSIOutput();
ansiOutput.processOutput(lines.join(LF));
ansiOutput.processOutput(lines.join(terminator));
const outputLines = ansiOutput.outputLines;

// Tests.
Expand All @@ -1721,6 +1722,9 @@ suite('ANSIOutout', () => {
assert.equal(ansiOutput['_outputLine' as keyof ANSIOutput] as unknown as number, outputLine);
assert.equal(ansiOutput['_outputColumn' as keyof ANSIOutput] as unknown as number, outputColumn);
};

// Ensure that no disposables are leaked.
ensureNoDisposablesAreLeakedInTestSuite();
});

//#endregion Test Suite

0 comments on commit f2238e0

Please sign in to comment.