summaryrefslogtreecommitdiffstats
path: root/src/test/CppTests/Config.test.ts
diff options
context:
space:
mode:
authorto-s <tobias.weber@enisyst.de>2020-10-19 12:38:51 -0400
committerGitHub <noreply@github.com>2020-10-19 18:38:51 +0200
commit771d246a96cd476fa9fddf600c532a28b2efd93a (patch)
treebd03b4bdec9a6a5bb85baca7ca7d988cde64fe95 /src/test/CppTests/Config.test.ts
parentd629202dd9419569c109475ad9f10405d8ab0d22 (diff)
downloaddoxdocgen-771d246a96cd476fa9fddf600c532a28b2efd93a.tar.gz
Substitute author and email by git config (#186)
* Substitute author and email by git config * Upgraded version of typescript Due to https://github.com/cschlosser/doxdocgen/pull/186#discussion_r505813068 * Moved to CppDocGen.generateAuthorTag() Due to https://github.com/cschlosser/doxdocgen/pull/186#discussion_r505819542 * Update README.md Due to https://github.com/cschlosser/doxdocgen/pull/186#discussion_r505822908 * Update TestSetup.ts * Added tests * Changed return type to string Due to https://ci.appveyor.com/project/cschlosser/doxdocgen/builds/35818180#L566 Co-authored-by: Christoph Schlosser <2466365+cschlosser@users.noreply.github.com>
Diffstat (limited to 'src/test/CppTests/Config.test.ts')
-rw-r--r--src/test/CppTests/Config.test.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/CppTests/Config.test.ts b/src/test/CppTests/Config.test.ts
index aae09d4..fcf2550 100644
--- a/src/test/CppTests/Config.test.ts
+++ b/src/test/CppTests/Config.test.ts
@@ -247,4 +247,32 @@ suite("C++ - Configuration Tests", () => {
assert.strictEqual("/**\n * @author MY_VARIABLE\n */", result);
});
+ test("Use git user.name as author", () => {
+ testSetup.cfg = new Config();
+ testSetup.cfg.Generic.useGitUserName = true;
+ const result = testSetup.SetLine("").GetResult();
+ assert.strictEqual("/**\n * @brief \n * \n * @file MockDocument.h\n * @author " +
+ testSetup.gitConfig.UserName +
+ " (you@domain.com)\n * @date " + moment().format("YYYY-MM-DD") + "\n */", result);
+ });
+
+ test("Use git user.email as email", () => {
+ testSetup.cfg = new Config();
+ testSetup.cfg.Generic.useGitUserEmail = true;
+ const result = testSetup.SetLine("").GetResult();
+ assert.strictEqual("/**\n * @brief \n * \n * @file MockDocument.h\n * @author your name (" +
+ testSetup.gitConfig.UserEmail +
+ ")\n * @date " + moment().format("YYYY-MM-DD") + "\n */", result);
+ });
+
+ test("Substitute author and email by git config", () => {
+ testSetup.cfg = new Config();
+ testSetup.cfg.Generic.useGitUserName = true;
+ testSetup.cfg.Generic.useGitUserEmail = true;
+ const result = testSetup.SetLine("").GetResult();
+ assert.strictEqual("/**\n * @brief \n * \n * @file MockDocument.h\n * @author " +
+ testSetup.gitConfig.UserName + " (" + testSetup.gitConfig.UserEmail+
+ ")\n * @date " + moment().format("YYYY-MM-DD") + "\n */", result);
+ });
+
});