diff options
| author | Christoph Schlosser <christoph@linux.com> | 2018-02-24 23:29:59 +0100 |
|---|---|---|
| committer | Christoph Schlosser <christophschlosser@users.noreply.github.com> | 2018-02-25 01:58:38 +0100 |
| commit | 041439c5544ca8f9627a922e125dbf7e7ad11769 (patch) | |
| tree | 9e3047bd1a3f40d1e2de02e5a736c26ad3980e68 /src/test/CppTests | |
| parent | f928a1049c6582e2fbb044676c5bbca89d9b7e33 (diff) | |
| download | doxdocgen-041439c5544ca8f9627a922e125dbf7e7ad11769.tar.gz | |
Add options and allow change of option order
Diffstat (limited to 'src/test/CppTests')
| -rw-r--r-- | src/test/CppTests/Config.test.ts | 7 | ||||
| -rw-r--r-- | src/test/CppTests/TestSetup.ts | 8 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/test/CppTests/Config.test.ts b/src/test/CppTests/Config.test.ts index 8a8e939..0459dcb 100644 --- a/src/test/CppTests/Config.test.ts +++ b/src/test/CppTests/Config.test.ts @@ -83,12 +83,13 @@ suite("C++ - Configuration Tests", () => { test("Lines to get test", () => { testSetup.cfg = new Config(); - testSetup.cfg.linesToGet = 1; - const negativeResult = testSetup.SetLines(["template<typename T> bool \n", "foo(T a);"]).GetResult(); - assert.equal("/**\n * @brief \n * \n */", negativeResult); testSetup.cfg.linesToGet = 2; const positiveResult = testSetup.SetLines(["template<typename T> bool \n", "foo(T a);"]).GetResult(); assert.equal("/**\n * @brief \n * \n * @tparam T \n * @param a \n * " + "@return true \n * @return false \n */", positiveResult); + testSetup.cfg.linesToGet = 0; + testSetup.firstLine = 1; + const negativeResult = testSetup.SetLines(["template<typename T> bool \n", "foo(T a);"]).GetResult(); + assert.equal("/**\n * @brief \n * \n */", negativeResult); }); }); diff --git a/src/test/CppTests/TestSetup.ts b/src/test/CppTests/TestSetup.ts index ee7256d..2e6c7f1 100644 --- a/src/test/CppTests/TestSetup.ts +++ b/src/test/CppTests/TestSetup.ts @@ -13,11 +13,12 @@ import MockSelection from "../tools/MockSelection"; export default class TestSetup { public cfg: Config; - + public firstLine: number; private editor: MockEditor; constructor(method: string) { this.cfg = new Config(); + this.firstLine = 0; this.SetLine(method); } @@ -38,7 +39,7 @@ export default class TestSetup { .map((l) => new MockLine(l)); } - const selection: MockSelection = new MockSelection(new MockPosition(0, 0)); + const selection: MockSelection = new MockSelection(new MockPosition(this.firstLine, 0)); const doc: MockDocument = new MockDocument(mockLines); this.editor = new MockEditor(selection, doc); @@ -51,7 +52,8 @@ export default class TestSetup { 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))); + // tslint:disable-next-line:max-line-length + gen.GenerateDoc(new vscode.Range(new vscode.Position(this.firstLine, 0), new vscode.Position(this.firstLine, 0))); return this.editor.editBuilder.text; } |