summaryrefslogtreecommitdiffstats
path: root/src/test/CppTests/TestSetup.ts
diff options
context:
space:
mode:
authorRowan Goemans <RB.Goemans@student.han.nl>2018-01-01 21:22:18 +0100
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2018-02-20 22:02:22 +0100
commit8711b0fb2c8f88a6864096de7813e63fd6cf9f7a (patch)
tree212fd2fb67cfd2f778e42ae955f869bc444afdb2 /src/test/CppTests/TestSetup.ts
parentd9cef62f8778fcdc39d26802d5d7457c97e9dfc0 (diff)
downloaddoxdocgen-8711b0fb2c8f88a6864096de7813e63fd6cf9f7a.tar.gz
-- Added tests for the configuration options.
-- Expanded the mock classes to allow for more dynamic setting of the contents.
Diffstat (limited to 'src/test/CppTests/TestSetup.ts')
-rw-r--r--src/test/CppTests/TestSetup.ts26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/test/CppTests/TestSetup.ts b/src/test/CppTests/TestSetup.ts
index 068cff2..ee7256d 100644
--- a/src/test/CppTests/TestSetup.ts
+++ b/src/test/CppTests/TestSetup.ts
@@ -17,23 +17,29 @@ export default class TestSetup {
private editor: MockEditor;
constructor(method: string) {
+ this.cfg = new Config();
this.SetLine(method);
}
public SetLine(method: string): TestSetup {
- this.cfg = new Config();
+ return this.SetLines([method]);
+ }
- let position: MockPosition;
- position = new MockPosition(0, 0);
+ public SetLines(lines: string[]): TestSetup {
+ let mockLines: MockLine[];
- let selection: MockSelection;
- selection = new MockSelection(position);
+ // Add two empty lines with just the indentation
+ // since one is for the triggersequence line.
+ // And the other is if the next empty line.
+ if (lines.length > 0) {
+ const indent: string = lines[0].match("^\\s*")[0];
- let line: MockLine;
- line = new MockLine(method);
+ mockLines = [indent, indent].concat(lines)
+ .map((l) => new MockLine(l));
+ }
- let doc: MockDocument;
- doc = new MockDocument(line);
+ const selection: MockSelection = new MockSelection(new MockPosition(0, 0));
+ const doc: MockDocument = new MockDocument(mockLines);
this.editor = new MockEditor(selection, doc);
@@ -42,7 +48,7 @@ export default class TestSetup {
public GetResult(): string {
let parser: CodeParser;
- parser = new CppParser(new Config());
+ parser = new CppParser(this.cfg);
const gen: IDocGen = parser.Parse(this.editor);
gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));