From 86595e38975f902d061df4a1e60783bfb725ad2f Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Fri, 8 Dec 2017 17:22:57 +0100 Subject: Add basic tests --- src/test/MockDocument.ts | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/test/MockDocument.ts (limited to 'src/test/MockDocument.ts') diff --git a/src/test/MockDocument.ts b/src/test/MockDocument.ts new file mode 100644 index 0000000..447adc9 --- /dev/null +++ b/src/test/MockDocument.ts @@ -0,0 +1,51 @@ +import * as vscode from "vscode"; +import MockLine from "./MockLine"; + +export default class MockDocument implements vscode.TextDocument { + public uri: vscode.Uri; + public fileName: string; + public isUntitled: boolean; + public languageId: string; + public version: number; + public isDirty: boolean; + public isClosed: boolean; + public eol: vscode.EndOfLine; + public lineCount: number; + private line: vscode.TextLine; + private firstCall: boolean; + public constructor(line: vscode.TextLine) { + this.line = line; + this.firstCall = true; + } + public save(): Thenable { + throw new Error("Method not implemented."); + } + public lineAt(line: number | vscode.Position): vscode.TextLine; + public lineAt(position: any): any { + if (this.firstCall) { + this.firstCall = false; + return this.line; + } else { + return new MockLine(";"); + } + } + public offsetAt(position: vscode.Position): number { + throw new Error("Method not implemented."); + } + public positionAt(offset: number): vscode.Position { + throw new Error("Method not implemented."); + } + public getText(range?: vscode.Range): string { + throw new Error("Method not implemented."); + } + public getWordRangeAtPosition(position: vscode.Position, regex?: RegExp): vscode.Range { + throw new Error("Method not implemented."); + } + public validateRange(range: vscode.Range): vscode.Range { + throw new Error("Method not implemented."); + } + public validatePosition(position: vscode.Position): vscode.Position { + throw new Error("Method not implemented."); + } + +} -- cgit v1.2.3