diff options
| author | HO-COOH <42881734+HO-COOH@users.noreply.github.com> | 2021-05-15 00:14:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-14 18:14:36 +0200 |
| commit | af70cf95d9d010f27da1c1c8987c807ee3255a10 (patch) | |
| tree | 9d6de559ea072c684f690d32816f7fe3ae1a88d3 /src/test/CppTests | |
| parent | be07386c572fe8258a3b4c101b85dd900867bb13 (diff) | |
| download | doxdocgen-af70cf95d9d010f27da1c1c8987c807ee3255a10.tar.gz | |
Refactor, add {file} template (#221)
* Refactor, add {file} template
* Add test for {file} expansion
Diffstat (limited to 'src/test/CppTests')
| -rw-r--r-- | src/test/CppTests/Config.test.ts | 8 | ||||
| -rw-r--r-- | src/test/CppTests/FileDescription.test.ts | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/test/CppTests/Config.test.ts b/src/test/CppTests/Config.test.ts index 1afbef3..f6ec573 100644 --- a/src/test/CppTests/Config.test.ts +++ b/src/test/CppTests/Config.test.ts @@ -11,6 +11,7 @@ import * as assert from "assert"; import * as moment from "moment"; import * as vscode from "vscode"; import { Config } from "../../Config"; +import GitConfig from "../../GitConfig"; import TestSetup from "./TestSetup"; // Defines a Mocha test suite to group tests of similar kind together @@ -242,11 +243,12 @@ suite("C++ - Configuration Tests", () => { "@author {author}", "@date {date}", "@note {email}", + "@file {file}", ]; - testSetup.cfg.Generic.useGitUserName = true; - testSetup.cfg.Generic.useGitUserEmail = true; const result = testSetup.SetLine("void foo();").GetResult(); - assert.notStrictEqual(result, "/**\n * @author {author}\n * @date {date}\n * @note {email}\n */"); + const date = moment().format("YYYY-MM-DD"); + assert.strictEqual(result, `/**\n * @author your name\n * @date ${date}\n * @note you@domain.com\n` + + ` * @file MockDocument.h\n */`); }); test("Env variable", () => { diff --git a/src/test/CppTests/FileDescription.test.ts b/src/test/CppTests/FileDescription.test.ts index 2e0bb7e..ec0034d 100644 --- a/src/test/CppTests/FileDescription.test.ts +++ b/src/test/CppTests/FileDescription.test.ts @@ -78,9 +78,9 @@ suite("File Description Tests", () => { test("custom block", () => { testSetup.cfg.File.fileOrder = ["custom"]; testSetup.cfg.File.customTag = ["First Line", "{year} Year Line", "{date} Date Line", - "{author} Author Line", "{email} Email Line"]; + "{author} Author Line", "{email} Email Line", "{file} File Line"]; const result = testSetup.SetLine("").GetResult(); assert.strictEqual(result, "/**\n * First Line\n * " + year + " Year Line\n * " + date + " Date Line\n" + - " * your name Author Line\n * you@domain.com Email Line\n */"); + " * your name Author Line\n * you@domain.com Email Line\n" + " * MockDocument.h File Line\n */"); }); }); |