r188657 - Comment parsing tests: move tests where they belong

Dmitri Gribenko gribozavr at gmail.com
Mon Aug 19 00:10:14 PDT 2013


Author: gribozavr
Date: Mon Aug 19 02:10:13 2013
New Revision: 188657

URL: http://llvm.org/viewvc/llvm-project?rev=188657&view=rev
Log:
Comment parsing tests: move tests where they belong

comment-misc-tags.m is mostly about miscellaneous Doxygen tags.  Move out tests
that check if the comment is attached to an ObjC decl.  Because the exitsting
test for this is in C++ (annotate-comments.cpp), create a new test --
annotate-comments-objc.m.

The rest of comment-misc-tags.m should be also moved elsewhere.

Added:
    cfe/trunk/test/Index/annotate-comments-objc.m
Modified:
    cfe/trunk/test/Index/comment-misc-tags.m

Added: cfe/trunk/test/Index/annotate-comments-objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-comments-objc.m?rev=188657&view=auto
==============================================================================
--- cfe/trunk/test/Index/annotate-comments-objc.m (added)
+++ cfe/trunk/test/Index/annotate-comments-objc.m Mon Aug 19 02:10:13 2013
@@ -0,0 +1,78 @@
+// Run lines are sensitive to line numbers and come below the code.
+
+#ifndef HEADER
+#define HEADER
+
+ at class NSString;
+
+//===---
+// rdar://14258334
+// Check that we attach comments to properties correctly.
+//===---
+
+ at interface MyClass {
+}
+
+/// property1_isdoxy1 IS_DOXYGEN_SINGLE
+ at property (nonatomic, copy, readwrite) NSString *property1_isdoxy1;
+ at property (nonatomic, copy, readwrite) NSString *property1_isdoxy2; ///< property1_isdoxy2 IS_DOXYGEN_SINGLE
+ at property (nonatomic, copy, readwrite) NSString *property1_isdoxy3; /**< property1_isdoxy3 IS_DOXYGEN_SINGLE */
+ at property (nonatomic, copy, readwrite) NSString *property1_isdoxy4; /*!< property1_isdoxy4 IS_DOXYGEN_SINGLE */
+
+/// method1_isdoxy1 IS_DOXYGEN_SINGLE
+- (void)method1_isdoxy1;
+- (void)method1_isdoxy2; /*!< method1_isdoxy2 IS_DOXYGEN_SINGLE */
+- (void)method1_isdoxy3; /*!< method1_isdoxy3 IS_DOXYGEN_SINGLE */
+- (void)method1_isdoxy4; /*!< method1_isdoxy4 IS_DOXYGEN_SINGLE */
+ at end
+
+
+#endif
+
+// RUN: rm -rf %t
+// RUN: mkdir %t
+
+// Check that we serialize comment source locations properly.
+// RUN: %clang_cc1 -emit-pch -o %t/out.pch %s
+// RUN: %clang_cc1 -include-pch %t/out.pch -fsyntax-only %s
+
+// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out.c-index-direct
+// RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch
+
+// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct
+// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-pch
+
+// Declarations without Doxygen comments should not pick up some Doxygen comments.
+// WRONG-NOT: notdoxy{{.*}}Comment=
+// WRONG-NOT: test{{.*}}Comment=
+
+// Non-Doxygen comments should not be attached to anything.
+// WRONG-NOT: NOT_DOXYGEN
+
+// Some Doxygen comments are not attached to anything.
+// WRONG-NOT: IS_DOXYGEN_NOT_ATTACHED
+
+// Ensure we don't pick up extra comments.
+// WRONG-NOT: IS_DOXYGEN_START{{.*}}IS_DOXYGEN_START{{.*}}BriefComment=
+// WRONG-NOT: IS_DOXYGEN_END{{.*}}IS_DOXYGEN_END{{.*}}BriefComment=
+//
+// Ensure that XML is not invalid
+// WRONG-NOT: CommentXMLInvalid
+
+// RUN: FileCheck %s < %t/out.c-index-direct
+// RUN: FileCheck %s < %t/out.c-index-pch
+
+// These CHECK lines are not located near the code on purpose.  This test
+// checks that documentation comments are attached to declarations correctly.
+// Adding a non-documentation comment with CHECK line between every two
+// documentation comments will only test a single code path.
+//
+// CHECK: annotate-comments-objc.m:17:50: ObjCPropertyDecl=property1_isdoxy1:{{.*}} property1_isdoxy1 IS_DOXYGEN_SINGLE
+// CHECK: annotate-comments-objc.m:18:50: ObjCPropertyDecl=property1_isdoxy2:{{.*}} property1_isdoxy2 IS_DOXYGEN_SINGLE
+// CHECK: annotate-comments-objc.m:19:50: ObjCPropertyDecl=property1_isdoxy3:{{.*}} property1_isdoxy3 IS_DOXYGEN_SINGLE
+// CHECK: annotate-comments-objc.m:20:50: ObjCPropertyDecl=property1_isdoxy4:{{.*}} property1_isdoxy4 IS_DOXYGEN_SINGLE
+// CHECK: annotate-comments-objc.m:23:9: ObjCInstanceMethodDecl=method1_isdoxy1:{{.*}} method1_isdoxy1 IS_DOXYGEN_SINGLE
+// CHECK: annotate-comments-objc.m:24:9: ObjCInstanceMethodDecl=method1_isdoxy2:{{.*}} method1_isdoxy2 IS_DOXYGEN_SINGLE
+// CHECK: annotate-comments-objc.m:25:9: ObjCInstanceMethodDecl=method1_isdoxy3:{{.*}} method1_isdoxy3 IS_DOXYGEN_SINGLE
+// CHECK: annotate-comments-objc.m:26:9: ObjCInstanceMethodDecl=method1_isdoxy4:{{.*}} method1_isdoxy4 IS_DOXYGEN_SINGLE
+

Modified: cfe/trunk/test/Index/comment-misc-tags.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-misc-tags.m?rev=188657&r1=188656&r2=188657&view=diff
==============================================================================
--- cfe/trunk/test/Index/comment-misc-tags.m (original)
+++ cfe/trunk/test/Index/comment-misc-tags.m Mon Aug 19 02:10:13 2013
@@ -109,31 +109,3 @@ struct Test {int filler;};
 // CHECK-NEXT:     (CXComment_Paragraph
 // CHECK-NEXT:     (CXComment_Text Text=[ And this is the second paragraph.])))
 
-// rdar://14258334
- at class NSString;
-
- at interface MyClass {
-}
-
-/// This is the first property and it always worked.
- at property (nonatomic, copy,   readwrite) NSString *     property1;
- at property (nonatomic, copy,   readwrite) NSString *     property2;        ///< This is the second property and it does not work.
- at property (nonatomic, copy,   readwrite) NSString *     property3;        /**< This is the third property and it does not work. */
-- (void)test; /*!< documentation for test method */
- at end
-// CHECK:  CommentAST=[
-// CHECK-NEXT:    (CXComment_FullComment
-// CHECK-NEXT:       (CXComment_Paragraph
-// CHECK-NEXT:         (CXComment_Text Text=[ This is the first property and it always worked.])))]
-// CHECK:  CommentAST=[
-// CHECK-NEXT:    (CXComment_FullComment
-// CHECK-NEXT:       (CXComment_Paragraph
-// CHECK-NEXT:         (CXComment_Text Text=[ This is the second property and it does not work.])))] 
-// CHECK:  CommentAST=[
-// CHECK-NEXT:    (CXComment_FullComment
-// CHECK-NEXT:       (CXComment_Paragraph
-// CHECK-NEXT:         (CXComment_Text Text=[ This is the third property and it does not work. ])))]
-// CHECK:  CommentAST=[
-// CHECK-NEXT:    (CXComment_FullComment
-// CHECK-NEXT:       (CXComment_Paragraph
-// CHECK-NEXT:         (CXComment_Text Text=[ documentation for test method ])))]





More information about the cfe-commits mailing list