diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Lang/Cpp/CppParser.ts | 3 | ||||
| -rw-r--r-- | src/test/CppTests/Templates.test.ts | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Lang/Cpp/CppParser.ts b/src/Lang/Cpp/CppParser.ts index 0fef5dc..8ed4bc8 100644 --- a/src/Lang/Cpp/CppParser.ts +++ b/src/Lang/Cpp/CppParser.ts @@ -808,6 +808,9 @@ export default class CppParser implements ICodeParser { // Remove <> and add a comma to the end to remove edge case. template = template.slice(template.indexOf("<") + 1, template.lastIndexOf(">")).replace(/^\s+|\s+$/g, "") + ","; + // Remove = and everything to the right until a , comes up + template = template.replace(/(\W*=\W*\S*\,)/gm, ","); + const nestedCounts: { [key: string]: number; } = { "(": 0, "<": 0, diff --git a/src/test/CppTests/Templates.test.ts b/src/test/CppTests/Templates.test.ts index 07a2144..0c4e1b6 100644 --- a/src/test/CppTests/Templates.test.ts +++ b/src/test/CppTests/Templates.test.ts @@ -48,4 +48,11 @@ suite("C++ - Template tests", () => { assert.equal("/**\n * @brief \n * \n * @tparam T \n * @tparam Args \n *" + " @param first \n * @param args \n * @return T \n */", result); }); + + test("Default template param value", () => { + const result = testSetup.SetLine("template <bool is_foo=false, bool is_bar =true, bool is_nothrow = true>" + + "\nstruct Foo;").GetResult(); + assert.equal("/**\n * @brief \n * \n * @tparam is_foo \n * @tparam is_bar \n *" + + " @tparam is_nothrow \n */", result); + }); }); |