summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2019-06-28 23:13:09 +0200
committerChristoph Schlosser <christoph@linux.com>2019-06-28 23:13:09 +0200
commitb4193c57675c394af91aeb745e6e8175ca827a01 (patch)
tree1c6220f27b1f216bbff50c5a8786c1966b3b96ef
parent1d863f634d197c786904e9d4ea87a556f9859af9 (diff)
downloaddoxdocgen-b4193c57675c394af91aeb745e6e8175ca827a01.tar.gz
Fix brief and add tests
-rw-r--r--src/Lang/Cpp/CppDocGen.ts4
-rw-r--r--src/test/CppTests/Config.test.ts23
2 files changed, 25 insertions, 2 deletions
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts
index 1c00546..5d2483f 100644
--- a/src/Lang/Cpp/CppDocGen.ts
+++ b/src/Lang/Cpp/CppDocGen.ts
@@ -216,8 +216,8 @@ export class CppDocGen implements IDocGen {
}
protected generateBrief(lines: string[]) {
- lines.push(this.getTemplatedString(this.cfg.textTemplateReplace,
- this.cfg.C.commentPrefix + this.cfg.Generic.briefTemplate,
+ lines.push(this.cfg.C.commentPrefix + this.getTemplatedString(this.cfg.textTemplateReplace,
+ this.cfg.Generic.briefTemplate,
this.getSmartText()));
}
diff --git a/src/test/CppTests/Config.test.ts b/src/test/CppTests/Config.test.ts
index 1ef2a4d..8d0d447 100644
--- a/src/test/CppTests/Config.test.ts
+++ b/src/test/CppTests/Config.test.ts
@@ -158,4 +158,27 @@ suite("C++ - Configuration Tests", () => {
const result = testSetup.SetLines(["*/", "int foo();"]).GetResult();
assert.equal("/**\n * @brief \n * \n * @return int \n */", result);
});
+
+ test("Single alignment", () => {
+ testSetup.cfg.Generic.paramTemplate = "@param{indent:10}{param}";
+ testSetup.cfg.Cpp.tparamTemplate = "@tparam{indent:10}{param}";
+ testSetup.cfg.Generic.returnTemplate = "@return{indent:10}{type}";
+ testSetup.cfg.Generic.briefTemplate = "@brief{indent:10}Brief";
+
+ const result = testSetup.SetLines(["template<typename T>", "int foo(std::string bar, T foobar);"]).GetResult();
+ // tslint:disable-next-line:max-line-length
+ assert.equal("/**\n * @brief Brief\n * \n * @tparam T\n * @param bar\n * @param foobar\n * @return int\n */", result);
+ });
+
+ test("Multi alignment", () => {
+ testSetup.cfg.Generic.paramTemplate = "@param{indent:10}{param}{indent:30}Parameters everywhere";
+ testSetup.cfg.Cpp.tparamTemplate = "@tparam{indent:10}{param}{indent:30}I'm a template";
+ testSetup.cfg.Generic.returnTemplate = "@return{indent:10}{type}{indent:30}Returns stuff";
+ testSetup.cfg.Generic.briefTemplate = "@brief{indent:30}Short desc";
+
+ const result = testSetup.SetLines(["template<typename T>", "int foo(std::string bar, T foobar);"]).GetResult();
+ // tslint:disable-next-line:max-line-length
+ assert.equal("/**\n * @brief Short desc\n * \n * @tparam T I'm a template\n * @param bar Parameters everywhere\n * @param foobar Parameters everywhere\n * @return int Returns stuff\n */", result);
+ });
+
});