summaryrefslogtreecommitdiffstats
path: root/src/test/CppTests/FileDescription.test.ts
diff options
context:
space:
mode:
authorDean Anderson <dean@locomation.ai>2018-09-27 16:51:01 -0400
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2018-09-29 19:08:20 +0200
commit4939806ae705953cfc1ca8cf54f20d98e9be9d03 (patch)
tree71c291d9c5edd2927f350b2dbdf738ca7ff6dfbf /src/test/CppTests/FileDescription.test.ts
parentd3452b0a1e9f4424591b5621ee107a95a61300d5 (diff)
downloaddoxdocgen-4939806ae705953cfc1ca8cf54f20d98e9be9d03.tar.gz
customTag will supply ISO date format if user configured format empty
Added separate templates for author name {author} and email {email} Added method to make multiple template substitutions in a string customTag will now replace {author}, {email}, {date} and {year} templates
Diffstat (limited to 'src/test/CppTests/FileDescription.test.ts')
-rw-r--r--src/test/CppTests/FileDescription.test.ts33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/test/CppTests/FileDescription.test.ts b/src/test/CppTests/FileDescription.test.ts
index 8c8d4d4..362c17a 100644
--- a/src/test/CppTests/FileDescription.test.ts
+++ b/src/test/CppTests/FileDescription.test.ts
@@ -15,18 +15,20 @@ import TestSetup from "./TestSetup";
// Defines a Mocha test suite to group tests of similar kind together
suite("File Description Tests", () => {
const testSetup: TestSetup = new TestSetup("void foo();");
+ testSetup.cfg.File.fileOrder = ["brief", "empty", "file", "author", "date"];
const date = moment().format("YYYY-MM-DD");
+ const year = moment().format("YYYY");
// Tests
test("#include on next line", () => {
const result = testSetup.SetLine("#include <iostream>").GetResult();
- assert.equal("/**\n * @brief \n * \n * @file MockDocument.h\n * @author your name\n" +
+ assert.equal("/**\n * @brief \n * \n * @file MockDocument.h\n * @author your name (you@domain.com)\n" +
" * @date " + date + "\n */", result);
});
test("On first line of document", () => {
const result = testSetup.SetLine("").GetResult();
- assert.equal("/**\n * @brief \n * \n * @file MockDocument.h\n * @author your name\n" +
+ assert.equal("/**\n * @brief \n * \n * @file MockDocument.h\n * @author your name (you@domain.com)\n" +
" * @date " + date + "\n */", result);
});
@@ -35,4 +37,31 @@ suite("File Description Tests", () => {
const result = testSetup.SetLine("").GetResult();
assert.equal("/**\n */", result);
});
+
+ test("version block", () => {
+ testSetup.cfg.File.fileOrder = ["version"];
+ const result = testSetup.SetLine("").GetResult();
+ assert.equal("/**\n * @version 0.1\n */", result);
+ });
+
+ test("Copyright block", () => {
+ testSetup.cfg.File.fileOrder = ["copyright"];
+ const result = testSetup.SetLine("").GetResult();
+ assert.equal("/**\n * @copyright Copyright (c) " + year + "\n */", result);
+ });
+
+ test("version block", () => {
+ testSetup.cfg.File.fileOrder = ["version"];
+ const result = testSetup.SetLine("").GetResult();
+ assert.equal("/**\n * @version 0.1\n */", result);
+ });
+
+ 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"];
+ const result = testSetup.SetLine("").GetResult();
+ assert.equal("/**\n * First Line\n * " + year + " Year Line\n * " + date + " Date Line\n" +
+ " * your name Author Line\n * you@domain.com Email Line\n */", result);
+ });
});