summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristoph Schlosser <thisisagap@gmail.com>2017-12-12 18:08:36 +0100
committerChristoph Schlosser <christophschlosser@users.noreply.github.com>2017-12-16 21:48:09 +0100
commit547d3f716b2b116d1fb460fb015927a0f1f8b37e (patch)
tree088208450ed411cdc1598307d5483982782c168b /src
parent86595e38975f902d061df4a1e60783bfb725ad2f (diff)
downloaddoxdocgen-547d3f716b2b116d1fb460fb015927a0f1f8b37e.tar.gz
Add more tests
Diffstat (limited to 'src')
-rw-r--r--src/test/extension.test.ts82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/test/extension.test.ts b/src/test/extension.test.ts
index f9d9c5a..8b9d9fd 100644
--- a/src/test/extension.test.ts
+++ b/src/test/extension.test.ts
@@ -94,4 +94,86 @@ suite("Comment generation", () => {
assert.equal("/**\n * @brief \n * \n * @param mat \n * @param fuzz \n * @return true \n * @return false \n */",
editor.editBuilder.text);
});
+
+ test("int main()", () => {
+ const gen: IDocGen = setup("int main()");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @return int \n */",
+ editor.editBuilder.text);
+ });
+
+ test("void foo(std::string str, std::vector<std::string> lst)", () => {
+ const gen: IDocGen = setup("void foo(std::string str, std::vector<std::string> lst)");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @param str \n * @param lst \n */",
+ editor.editBuilder.text);
+ });
+
+ test("std::vector<int> foo()", () => {
+ const gen: IDocGen = setup("std::vector<int> foo()");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @return std::vector<int> \n */",
+ editor.editBuilder.text);
+ });
+
+ test("myClass(int i)", () => {
+ const gen: IDocGen = setup("myClass(int i)");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @param i \n */",
+ editor.editBuilder.text);
+ });
+
+ test("myClass(int i) : i(i)", () => {
+ const gen: IDocGen = setup("myClass(int i) : i(i)");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @param i \n */",
+ editor.editBuilder.text);
+ });
+
+ test("virtual ~myClass()", () => {
+ const gen: IDocGen = setup("virtual ~myClass()");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n */",
+ editor.editBuilder.text);
+ });
+
+ test("static inline unsigned int rewind_tospace(const unsigned char* chunk, unsigned int len)", () => {
+ // tslint:disable-next-line:max-line-length
+ const gen: IDocGen = setup("static inline unsigned int rewind_tospace(const unsigned char* chunk, unsigned int len)");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @param chunk \n * @param len \n * @return unsigned int \n */",
+ editor.editBuilder.text);
+ });
+
+ test("void foo_bar(void (*my_function_pointer) (unsigned int arg1, char arg2))", () => {
+ const gen: IDocGen = setup("void foo_bar(void (*my_function_pointer) (unsigned int arg1, char arg2))");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @param my_function_pointer \n */",
+ editor.editBuilder.text);
+ });
+
+ test("int (*idputs(int (*puts)(const char *)))(const char *)", () => {
+ const gen: IDocGen = setup("int (*idputs(int (*puts)(const char *)))(const char *)");
+
+ gen.GenerateDoc(new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 0)));
+
+ assert.equal("/**\n * @brief \n * \n * @param puts \n * @return int(*)(const char*) \n */",
+ editor.editBuilder.text);
+ });
});