diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-14 16:35:35 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-14 16:35:35 +0000 |
commit | 8c05da3fd8db98af482826ba059ab1ad6d58010f (patch) | |
tree | f244d88fa34892e580964a51d85be2dc66b3512a /unittests/AST/CommentLexer.cpp | |
parent | 388a594cd04aae78be452f6eacb9ca6be239c1f8 (diff) |
Comment parsing: don't parse comment marker followed by a digit as a command
since no Doxygen command starts with a digit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/AST/CommentLexer.cpp')
-rw-r--r-- | unittests/AST/CommentLexer.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/unittests/AST/CommentLexer.cpp b/unittests/AST/CommentLexer.cpp index 2ec741ba3d..cc4535a163 100644 --- a/unittests/AST/CommentLexer.cpp +++ b/unittests/AST/CommentLexer.cpp @@ -322,7 +322,35 @@ TEST_F(CommentLexerTest, DoxygenCommand4) { } } +// A command marker followed by a non-letter that is not a part of an escape +// sequence. TEST_F(CommentLexerTest, DoxygenCommand5) { + const char *Source = "/// \\^ \\0"; + std::vector<Token> Toks; + + lexString(Source, Toks); + + ASSERT_EQ(6U, Toks.size()); + + ASSERT_EQ(tok::text, Toks[0].getKind()); + ASSERT_EQ(StringRef(" "), Toks[0].getText()); + + ASSERT_EQ(tok::text, Toks[1].getKind()); + ASSERT_EQ(StringRef("\\"), Toks[1].getText()); + + ASSERT_EQ(tok::text, Toks[2].getKind()); + ASSERT_EQ(StringRef("^ "), Toks[2].getText()); + + ASSERT_EQ(tok::text, Toks[3].getKind()); + ASSERT_EQ(StringRef("\\"), Toks[3].getText()); + + ASSERT_EQ(tok::text, Toks[4].getKind()); + ASSERT_EQ(StringRef("0"), Toks[4].getText()); + + ASSERT_EQ(tok::newline, Toks[5].getKind()); +} + +TEST_F(CommentLexerTest, DoxygenCommand6) { const char *Source = "/// \\brief Aaa."; std::vector<Token> Toks; @@ -342,7 +370,7 @@ TEST_F(CommentLexerTest, DoxygenCommand5) { ASSERT_EQ(tok::newline, Toks[3].getKind()); } -TEST_F(CommentLexerTest, DoxygenCommand6) { +TEST_F(CommentLexerTest, DoxygenCommand7) { const char *Source = "/// \\em\\em \\em\t\\em\n"; std::vector<Token> Toks; @@ -374,7 +402,7 @@ TEST_F(CommentLexerTest, DoxygenCommand6) { ASSERT_EQ(tok::newline, Toks[7].getKind()); } -TEST_F(CommentLexerTest, DoxygenCommand7) { +TEST_F(CommentLexerTest, DoxygenCommand8) { const char *Source = "/// \\aaa\\bbb \\ccc\t\\ddd\n"; std::vector<Token> Toks; @@ -406,7 +434,7 @@ TEST_F(CommentLexerTest, DoxygenCommand7) { ASSERT_EQ(tok::newline, Toks[7].getKind()); } -TEST_F(CommentLexerTest, DoxygenCommand8) { +TEST_F(CommentLexerTest, DoxygenCommand9) { const char *Source = "// \\c\n"; std::vector<Token> Toks; |