From e689a0085cdd5329611a982f666104cec1477a03 Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Mon, 29 Jun 2020 21:35:32 +0200 Subject: Fix detection of closing comments (#162) * Fix detection of closing comments * Add tests --- src/test/CppTests/Preprocessor.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/test') diff --git a/src/test/CppTests/Preprocessor.test.ts b/src/test/CppTests/Preprocessor.test.ts index c89a80a..7e4708b 100644 --- a/src/test/CppTests/Preprocessor.test.ts +++ b/src/test/CppTests/Preprocessor.test.ts @@ -30,4 +30,23 @@ suite("C++ - Preprocessor Tests", () => { ]).GetResult(); assert.equal("/**\n * @brief \n * \n */", result); }); + + // These two tests don't seem to belong here but the behavior they're testing only is reproducable + // for macros otherwise + test("detect auto generated closing */", () => { + const result = testSetup.SetLines([ + "*/", // simulate an auto generated closing block comment + "void foo(int bar);", + ]).GetResult(); + assert.equal("/**\n * @brief \n * \n * @param bar \n */", result); + }); + + test("don't detect closing */", () => { + const result = testSetup.SetLines([ + "/*", + " */", + "void foo(int bar);", + ]).GetResult(); + assert.equal("/**\n * @brief \n * \n */", result); + }); }); -- cgit v1.2.3