summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2018-03-02 22:21:22 +0100
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2018-03-02 23:27:10 +0100
commit16452c8e0c644fa979270e99906eb9c34a13ca5f (patch)
tree25173bf8f8b79167193ce36094bf80399b1ea724 /src/test
parentb837545df65a31ba5dac154644c359c2a55d1531 (diff)
downloaddoxdocgen-16452c8e0c644fa979270e99906eb9c34a13ca5f.tar.gz
Make order of comment tags customizable
Fix #55
Diffstat (limited to 'src/test')
-rw-r--r--src/test/CppTests/Config.test.ts22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/test/CppTests/Config.test.ts b/src/test/CppTests/Config.test.ts
index ee6a90f..69837ce 100644
--- a/src/test/CppTests/Config.test.ts
+++ b/src/test/CppTests/Config.test.ts
@@ -25,6 +25,21 @@ suite("C++ - Configuration Tests", () => {
+ "@return true \n * @return false \n */", result);
});
+ test("Comment order", () => {
+ testSetup.cfg = new Config();
+ testSetup.cfg.Generic.order = ["brief", "param", "tparam", "return"];
+ const result = testSetup.SetLine("template<typename T> bool foo(T a);").GetResult();
+ assert.equal("/**\n * @brief \n * @param a \n * @tparam T \n * "
+ + "@return true \n * @return false \n */", result);
+ });
+
+ test("Non existing order param", () => {
+ testSetup.cfg = new Config();
+ testSetup.cfg.Generic.order = ["breif"];
+ const result = testSetup.SetLine("template<typename T> bool foo(T a);").GetResult();
+ assert.equal("/**\n */", result);
+ });
+
test("Modified template", () => {
testSetup.cfg = new Config();
@@ -61,11 +76,10 @@ suite("C++ - Configuration Tests", () => {
test("Newlines after params and tparams but not after brief", () => {
testSetup.cfg = new Config();
- testSetup.cfg.Generic.newLineAfterBrief = false;
- testSetup.cfg.Generic.newLineAfterParams = true;
- testSetup.cfg.Cpp.newLineAfterTParams = true;
+ testSetup.cfg.Generic.order = ["brief", "tparam", "empty", "param", "empty", "return"];
const result = testSetup.SetLine("template<typename T> bool foo(T a);").GetResult();
+ testSetup.cfg.Generic.order = ["brief", "empty", "tparam", "param", "return"]; // reset to default
assert.equal("/**\n * @brief \n * @tparam T \n * \n * @param a \n * \n"
+ " * @return true \n * @return false \n */", result);
});
@@ -99,7 +113,7 @@ suite("C++ - Configuration Tests", () => {
testSetup.firstLine = 0;
testSetup.cfg.File.fileOrder = ["brief", "author", "date", "file"];
const result = testSetup.SetLine("").GetResult();
- assert.equal("/**\n * @brief \n * \n * @author your name\n" +
+ assert.equal("/**\n * @brief \n * @author your name\n" +
" * @date " + moment().format("YYYY-MM-DD") + "\n * @file MockDocument.h\n */", result);
});