From 1a1d30d43b3c63412dd22e311112bd3798c179d4 Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Wed, 20 Nov 2013 01:23:26 +0000 Subject: [PATCH] Comment parsing tests: introduce a little more structure in testcase llvm-svn: 195187 --- .../Index/comment-to-html-xml-conversion.cpp | 94 ++++++++++++------- 1 file changed, 59 insertions(+), 35 deletions(-) diff --git a/clang/test/Index/comment-to-html-xml-conversion.cpp b/clang/test/Index/comment-to-html-xml-conversion.cpp index 249dffc99385..91986320fadc 100644 --- a/clang/test/Index/comment-to-html-xml-conversion.cpp +++ b/clang/test/Index/comment-to-html-xml-conversion.cpp @@ -25,6 +25,10 @@ #ifndef HEADER #define HEADER +//===--- +// Tests for \brief and its aliases. +//===--- + /// Aaa. void test_cmd_brief_like_1(); @@ -127,12 +131,16 @@ void test_cmd_brief_like_7(); // CHECK-NEXT: (CXComment_Paragraph // CHECK-NEXT: (CXComment_Text Text=[ Bbb.])))] +//===--- +// Tests for \returns and its aliases. +//===--- + /// Aaa. /// /// \return Bbb. -void comment_to_html_conversion_7(); +void test_cmd_returns_like_1(); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_7:{{.*}} FullCommentAsHTML=[

Aaa.

Returns Bbb.

] FullCommentAsXML=[comment_to_html_conversion_7c:@F@comment_to_html_conversion_7#void comment_to_html_conversion_7() Aaa. Bbb.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_returns_like_1:{{.*}} FullCommentAsHTML=[

Aaa.

Returns Bbb.

] FullCommentAsXML=[test_cmd_returns_like_1c:@F@test_cmd_returns_like_1#void test_cmd_returns_like_1() Aaa. Bbb.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment @@ -147,9 +155,9 @@ void comment_to_html_conversion_7(); /// Aaa. /// /// \returns Bbb. -void comment_to_html_conversion_8(); +void test_cmd_returns_like_2(); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_8:{{.*}} FullCommentAsHTML=[

Aaa.

Returns Bbb.

] FullCommentAsXML=[comment_to_html_conversion_8c:@F@comment_to_html_conversion_8#void comment_to_html_conversion_8() Aaa. Bbb.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_returns_like_2:{{.*}} FullCommentAsHTML=[

Aaa.

Returns Bbb.

] FullCommentAsXML=[test_cmd_returns_like_2c:@F@test_cmd_returns_like_2#void test_cmd_returns_like_2() Aaa. Bbb.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph @@ -163,9 +171,9 @@ void comment_to_html_conversion_8(); /// Aaa. /// /// \result Bbb. -void comment_to_html_conversion_9(); +void test_cmd_returns_like_3(); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_9:{{.*}} FullCommentAsHTML=[

Aaa.

Returns Bbb.

] FullCommentAsXML=[comment_to_html_conversion_9c:@F@comment_to_html_conversion_9#void comment_to_html_conversion_9() Aaa. Bbb.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_returns_like_3:{{.*}} FullCommentAsHTML=[

Aaa.

Returns Bbb.

] FullCommentAsXML=[test_cmd_returns_like_3c:@F@test_cmd_returns_like_3#void test_cmd_returns_like_3() Aaa. Bbb.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph @@ -178,9 +186,9 @@ void comment_to_html_conversion_9(); /// \returns Aaa. /// \returns Bbb. -void comment_to_html_conversion_10(); +void test_cmd_returns_like_4(); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_10:{{.*}} FullCommentAsHTML=[

Returns Aaa.

Returns Bbb.

] FullCommentAsXML=[comment_to_html_conversion_10c:@F@comment_to_html_conversion_10#void comment_to_html_conversion_10() Aaa. Bbb.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_returns_like_4:{{.*}} FullCommentAsHTML=[

Returns Aaa.

Returns Bbb.

] FullCommentAsXML=[test_cmd_returns_like_4c:@F@test_cmd_returns_like_4#void test_cmd_returns_like_4() Aaa. Bbb.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -198,9 +206,9 @@ void comment_to_html_conversion_10(); /// Bbb. /// /// \returns Ccc. -void comment_to_html_conversion_11(); +void test_cmd_returns_like_5(); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_11:{{.*}} FullCommentAsHTML=[

Aaa.

Bbb.

Returns Ccc.

] FullCommentAsXML=[comment_to_html_conversion_11c:@F@comment_to_html_conversion_11#void comment_to_html_conversion_11() Aaa. Ccc. Bbb.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_returns_like_5:{{.*}} FullCommentAsHTML=[

Aaa.

Bbb.

Returns Ccc.

] FullCommentAsXML=[test_cmd_returns_like_5c:@F@test_cmd_returns_like_5#void test_cmd_returns_like_5() Aaa. Ccc. Bbb.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph @@ -213,10 +221,14 @@ void comment_to_html_conversion_11(); // CHECK-NEXT: (CXComment_Paragraph // CHECK-NEXT: (CXComment_Text Text=[ Ccc.]))))] -/// \param -void comment_to_html_conversion_12(int x1); +//===--- +// Tests for \param. +//===--- -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_12:{{.*}} FullCommentAsHTML=[] FullCommentAsXML=[comment_to_html_conversion_12c:@F@comment_to_html_conversion_12#I#void comment_to_html_conversion_12(int x1)] +/// \param +void test_cmd_param_1(int x1); + +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_param_1:{{.*}} FullCommentAsHTML=[] FullCommentAsXML=[test_cmd_param_1c:@F@test_cmd_param_1#I#void test_cmd_param_1(int x1)] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -225,9 +237,9 @@ void comment_to_html_conversion_12(int x1); // CHECK-NEXT: (CXComment_Paragraph IsWhitespace)))] /// \param x1 Aaa. -void comment_to_html_conversion_13(int x1); +void test_cmd_param_2(int x1); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_13:{{.*}} FullCommentAsHTML=[
x1
Aaa.
] FullCommentAsXML=[comment_to_html_conversion_13c:@F@comment_to_html_conversion_13#I#void comment_to_html_conversion_13(int x1)x10in Aaa.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_param_2:{{.*}} FullCommentAsHTML=[
x1
Aaa.
] FullCommentAsXML=[test_cmd_param_2c:@F@test_cmd_param_2#I#void test_cmd_param_2(int x1)x10in Aaa.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -237,9 +249,9 @@ void comment_to_html_conversion_13(int x1); // CHECK-NEXT: (CXComment_Text Text=[ Aaa.]))))] /// \param zzz Aaa. -void comment_to_html_conversion_14(int x1); +void test_cmd_param_3(int x1); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_14:{{.*}} FullCommentAsHTML=[
zzz
Aaa.
] FullCommentAsXML=[comment_to_html_conversion_14c:@F@comment_to_html_conversion_14#I#void comment_to_html_conversion_14(int x1)zzzin Aaa.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_param_3:{{.*}} FullCommentAsHTML=[
zzz
Aaa.
] FullCommentAsXML=[test_cmd_param_3c:@F@test_cmd_param_3#I#void test_cmd_param_3(int x1)zzzin Aaa.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -250,9 +262,9 @@ void comment_to_html_conversion_14(int x1); /// \param x2 Bbb. /// \param x1 Aaa. -void comment_to_html_conversion_15(int x1, int x2); +void test_cmd_param_4(int x1, int x2); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_15:{{.*}} FullCommentAsHTML=[
x1
Aaa.
x2
Bbb.
] FullCommentAsXML=[comment_to_html_conversion_15c:@F@comment_to_html_conversion_15#I#I#void comment_to_html_conversion_15(int x1, int x2)x10in Aaa.x21in Bbb. ] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_param_4:{{.*}} FullCommentAsHTML=[
x1
Aaa.
x2
Bbb.
] FullCommentAsXML=[test_cmd_param_4c:@F@test_cmd_param_4#I#I#void test_cmd_param_4(int x1, int x2)x10in Aaa.x21in Bbb. ] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -268,9 +280,9 @@ void comment_to_html_conversion_15(int x1, int x2); /// \param x2 Bbb. /// \param zzz Aaa. /// \param x1 Aaa. -void comment_to_html_conversion_16(int x1, int x2); +void test_cmd_param_5(int x1, int x2); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_16:{{.*}} FullCommentAsHTML=[
x1
Aaa.
x2
Bbb.
zzz
Aaa.
] FullCommentAsXML=[comment_to_html_conversion_16c:@F@comment_to_html_conversion_16#I#I#void comment_to_html_conversion_16(int x1, int x2)x10in Aaa.x21in Bbb. zzzin Aaa. ] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_param_5:{{.*}} FullCommentAsHTML=[
x1
Aaa.
x2
Bbb.
zzz
Aaa.
] FullCommentAsXML=[test_cmd_param_5c:@F@test_cmd_param_5#I#I#void test_cmd_param_5(int x1, int x2)x10in Aaa.x21in Bbb. zzzin Aaa. ] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -289,9 +301,9 @@ void comment_to_html_conversion_16(int x1, int x2); /// \param x1 Aaa. /// \param ... Bbb. -void comment_to_html_conversion_17(int x1, ...); +void test_cmd_param_6(int x1, ...); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_17:{{.*}} FullCommentAsHTML=[
x1
Aaa.
...
Bbb.
] FullCommentAsXML=[comment_to_html_conversion_17c:@F@comment_to_html_conversion_17#I.#void comment_to_html_conversion_17(int x1, ...)x10in Aaa. ...in Bbb.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_cmd_param_6:{{.*}} FullCommentAsHTML=[
x1
Aaa.
...
Bbb.
] FullCommentAsXML=[test_cmd_param_6c:@F@test_cmd_param_6#I.#void test_cmd_param_6(int x1, ...)x10in Aaa. ...in Bbb.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -304,12 +316,16 @@ void comment_to_html_conversion_17(int x1, ...); // CHECK-NEXT: (CXComment_Paragraph // CHECK-NEXT: (CXComment_Text Text=[ Bbb.]))))] +//===--- +// Tests for \tparam. +//===--- + /// \tparam /// \param aaa Blah blah template -void comment_to_html_conversion_18(T aaa); +void test_cmd_tparam_1(T aaa); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=comment_to_html_conversion_18:{{.*}} FullCommentAsHTML=[
aaa
Blah blah
] FullCommentAsXML=[comment_to_html_conversion_18c:@FT@>1#Tcomment_to_html_conversion_18#t0.0#template <typename T> void comment_to_html_conversion_18(T aaa)aaa0in Blah blah] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=test_cmd_tparam_1:{{.*}} FullCommentAsHTML=[
aaa
Blah blah
] FullCommentAsXML=[test_cmd_tparam_1c:@FT@>1#Ttest_cmd_tparam_1#t0.0#template <typename T> void test_cmd_tparam_1(T aaa)aaa0in Blah blah] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -324,9 +340,9 @@ void comment_to_html_conversion_18(T aaa); /// \tparam T /// \param aaa Blah blah template -void comment_to_html_conversion_19(T aaa); +void test_cmd_tparam_2(T aaa); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=comment_to_html_conversion_19:{{.*}} FullCommentAsHTML=[
aaa
Blah blah
] FullCommentAsXML=[comment_to_html_conversion_19c:@FT@>1#Tcomment_to_html_conversion_19#t0.0#template <typename T> void comment_to_html_conversion_19(T aaa)aaa0in Blah blah] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=test_cmd_tparam_2:{{.*}} FullCommentAsHTML=[
aaa
Blah blah
] FullCommentAsXML=[test_cmd_tparam_2c:@FT@>1#Ttest_cmd_tparam_2#t0.0#template <typename T> void test_cmd_tparam_2(T aaa)aaa0in Blah blah] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -341,9 +357,9 @@ void comment_to_html_conversion_19(T aaa); /// \tparam T2 Bbb /// \tparam T1 Aaa template -void comment_to_html_conversion_20(T1 aaa, T2 bbb); +void test_cmd_tparam_3(T1 aaa, T2 bbb); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=comment_to_html_conversion_20:{{.*}} FullCommentAsHTML=[
T1
Aaa
T2
Bbb
] FullCommentAsXML=[comment_to_html_conversion_20c:@FT@>2#T#Tcomment_to_html_conversion_20#t0.0#t0.1#template <typename T1, typename T2>\nvoid comment_to_html_conversion_20(T1 aaa, T2 bbb)T10 AaaT21 Bbb ] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=test_cmd_tparam_3:{{.*}} FullCommentAsHTML=[
T1
Aaa
T2
Bbb
] FullCommentAsXML=[test_cmd_tparam_3c:@FT@>2#T#Ttest_cmd_tparam_3#t0.0#t0.1#template <typename T1, typename T2> void test_cmd_tparam_3(T1 aaa, T2 bbb)T10 AaaT21 Bbb ] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -361,9 +377,9 @@ void comment_to_html_conversion_20(T1 aaa, T2 bbb); /// \tparam V Ccc /// \tparam T1 Aaa template -void comment_to_html_conversion_21(T1 aaa, T2 bbb); +void test_cmd_tparam_4(T1 aaa, T2 bbb); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=comment_to_html_conversion_21:{{.*}} FullCommentAsHTML=[
T1
Aaa
T2
Bbb
V
Ccc
U
Zzz
] FullCommentAsXML=[comment_to_html_conversion_21c:@FT@>3#T#T#NIcomment_to_html_conversion_21#t0.0#t0.1#template <typename T1, typename T2, int V>\nvoid comment_to_html_conversion_21(T1 aaa, T2 bbb)T10 AaaT21 Bbb V2 Ccc U Zzz ] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=test_cmd_tparam_4:{{.*}} FullCommentAsHTML=[
T1
Aaa
T2
Bbb
V
Ccc
U
Zzz
] FullCommentAsXML=[test_cmd_tparam_4c:@FT@>3#T#T#NItest_cmd_tparam_4#t0.0#t0.1#template <typename T1, typename T2, int V>\nvoid test_cmd_tparam_4(T1 aaa, T2 bbb)T10 AaaT21 Bbb V2 Ccc U Zzz ] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -389,9 +405,9 @@ void comment_to_html_conversion_21(T1 aaa, T2 bbb); /// \tparam T Aaa /// \tparam TT Bbb template class TT, class C> class TTT> -void comment_to_html_conversion_22(); +void test_cmd_tparam_5(); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=comment_to_html_conversion_22:{{.*}} FullCommentAsHTML=[
TTT
Ddd
C
Ccc
T
Aaa
TT
Bbb
] FullCommentAsXML=[comment_to_html_conversion_22c:@FT@>1#t>2#t>1#T#Tcomment_to_html_conversion_22#template <template <template <typename T> class TT, class C> class TTT>\nvoid comment_to_html_conversion_22()TTT0 Ddd C Ccc T Aaa TT Bbb] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionTemplate=test_cmd_tparam_5:{{.*}} FullCommentAsHTML=[
TTT
Ddd
C
Ccc
T
Aaa
TT
Bbb
] FullCommentAsXML=[test_cmd_tparam_5c:@FT@>1#t>2#t>1#T#Ttest_cmd_tparam_5#template <template <template <typename T> class TT, class C> class TTT>\nvoid test_cmd_tparam_5()TTT0 Ddd C Ccc T Aaa TT Bbb] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -412,6 +428,10 @@ void comment_to_html_conversion_22(); // CHECK-NEXT: (CXComment_Paragraph // CHECK-NEXT: (CXComment_Text Text=[ Bbb]))))] +//===--- +// Tests for interaction between commands. +//===--- + /// \brief Aaa. /// /// Bbb. @@ -419,9 +439,9 @@ void comment_to_html_conversion_22(); /// \param x2 Ddd. /// \param x1 Ccc. /// \returns Eee. -void comment_to_html_conversion_23(int x1, int x2); +void test_full_comment_1(int x1, int x2); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_html_conversion_23:{{.*}} FullCommentAsHTML=[

Aaa.

Bbb.

x1
Ccc.
x2
Ddd.

Returns Eee.

] FullCommentAsXML=[comment_to_html_conversion_23c:@F@comment_to_html_conversion_23#I#I#void comment_to_html_conversion_23(int x1, int x2) Aaa.x10in Ccc. x21in Ddd. Eee. Bbb.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=test_full_comment_1:{{.*}} FullCommentAsHTML=[

Aaa.

Bbb.

x1
Ccc.
x2
Ddd.

Returns Eee.

] FullCommentAsXML=[test_full_comment_1c:@F@test_full_comment_1#I#I#void test_full_comment_1(int x1, int x2) Aaa.x10in Ccc. x21in Ddd. Eee. Bbb.] // CHECK-NEXT: CommentAST=[ // CHECK-NEXT: (CXComment_FullComment // CHECK-NEXT: (CXComment_Paragraph IsWhitespace @@ -445,6 +465,10 @@ void comment_to_html_conversion_23(int x1, int x2); // CHECK-NEXT: (CXComment_Paragraph // CHECK-NEXT: (CXComment_Text Text=[ Eee.]))))] +//===--- +// Misc tests. +//===--- + ///
Aaa void comment_to_html_conversion_24();