From 8711b0fb2c8f88a6864096de7813e63fd6cf9f7a Mon Sep 17 00:00:00 2001 From: Rowan Goemans Date: Mon, 1 Jan 2018 21:22:18 +0100 Subject: -- Added tests for the configuration options. -- Expanded the mock classes to allow for more dynamic setting of the contents. --- src/test/tools/MockDocument.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/test/tools') diff --git a/src/test/tools/MockDocument.ts b/src/test/tools/MockDocument.ts index cb6bbfe..781dbfe 100644 --- a/src/test/tools/MockDocument.ts +++ b/src/test/tools/MockDocument.ts @@ -11,24 +11,19 @@ export default class MockDocument implements vscode.TextDocument { public isClosed: boolean; public eol: vscode.EndOfLine; public lineCount: number; - private line: vscode.TextLine; - private callCount: number; - public constructor(line: vscode.TextLine) { - this.line = line; - this.callCount = 0; + private lines: vscode.TextLine[]; + public constructor(lines: vscode.TextLine[]) { + this.lines = lines; } public save(): Thenable { throw new Error("Method not implemented."); } public lineAt(line: number | vscode.Position): vscode.TextLine; public lineAt(position: any): any { - if (++this.callCount === 1) { - return new MockLine(""); - } else if (this.callCount === 2) { - return this.line; - } else { + if (position >= this.lines.length) { return new MockLine(";"); } + return this.lines[position]; } public offsetAt(position: vscode.Position): number { throw new Error("Method not implemented."); -- cgit v1.2.3