forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment_merge.swift
128 lines (99 loc) · 4.11 KB
/
comment_merge.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// NOTE: This file is sensitive to line numbers. Thus RUN and CHECK lines come
// below the code.
//
// NOTE: Please don't change this file to use FileCheck's feature to match
// relative line numbers: those lines are comments and we don't want to see
// anything extra in a test for documentation comments.
//===--- Check how we merge consecutive comments.
// not_doc1 NOT_DOC
func not_doc1() {}
/* not_doc2 NOT_DOC */
func not_doc2() {}
//! Doxygen comment, but not Swift. not_doc3 NOT_DOC
func not_doc3() {}
/*! Doxygen comment, but not Swift. not_doc4 NOT_DOC */
func not_doc4() {}
/*/ not_doc5 NOT_DOC */
func not_doc5() {}
/** is_doc6 IS_DOC_SINGLE */
func is_doc6() {}
/**
* is_doc7 IS_DOC_SINGLE */
func is_doc7() {}
/**
* is_doc8
* IS_DOC_SINGLE */
func is_doc8() {}
/**
* is_doc9
* IS_DOC_SINGLE
*/
func is_doc9() {}
/// is_doc10 IS_DOC_SINGLE
func is_doc10() {}
// Aaa. is_doc11 NOT_DOC
/// Bbb. is_doc11 IS_DOC_SINGLE
func is_doc11() {}
/// This comment is attached in Doxygen, but not in Swift. not_doc12 IS_DOC_NOT_ATTACHED
// Not a Doxygen comment. NOT_DOC
func not_doc12() {}
/** This comment is attached in Doxygen, but not in Swift. not_doc13 IS_DOC_NOT_ATTACHED */
/* Not a Doxygen comment. not_doc13 NOT_DOC */
func not_doc13() {}
/// is_doc14 IS_DOC_START
/// IS_DOC_END
func is_doc14() {}
/// is_doc15 IS_DOC_START
/// Aaa bbb ccc.
/// IS_DOC_END
func is_doc15() {}
/// is_doc16 IS_DOC_START
/** Aaa bbb ccc. */
/// IS_DOC_END
func is_doc16() {}
/** Aaa is_doc17 IS_DOC_START *//** bbb */
/// IS_DOC_END
func is_doc17() {}
/// IS_DOC_NOT_ATTACHED
// NOT_DOC
/// is_doc18 IS_DOC_START IS_DOC_END
func is_doc18() {}
// Aaa. NOT_DOC
/// is_doc19 IS_DOC_START
/** Aaa
*
* Bbb */
/// Ccc
/** Ddd
* Eee IS_DOC_END
*/
func is_doc19() {}
// RUN: %target-swift-ide-test -print-comments -source-filename %s > %t.txt
// RUN: %FileCheck %s -check-prefix=WRONG < %t.txt
// RUN: %FileCheck %s < %t.txt
// Non-documentation comments should not be attached to anything.
// WRONG-NOT: NOT_DOC
// Some comments are not attached to anything.
// WRONG-NOT: IS_DOC_NOT_ATTACHED
// Ensure we don't pick up extra comments.
// WRONG-NOT: RawComment={{.*}}IS_DOC_START{{.*}}IS_DOC_START{{.*}}BriefComment=
// WRONG-NOT: RawComment={{.*}}IS_DOC_END{{.*}}IS_DOC_END{{.*}}BriefComment=
// CHECK: comment_merge.swift:14:6: Func/not_doc1 RawComment=none
// CHECK-NEXT: comment_merge.swift:17:6: Func/not_doc2 RawComment=none
// CHECK-NEXT: comment_merge.swift:20:6: Func/not_doc3 RawComment=none
// CHECK-NEXT: comment_merge.swift:23:6: Func/not_doc4 RawComment=none
// CHECK-NEXT: comment_merge.swift:26:6: Func/not_doc5 RawComment=none
// CHECK-NEXT: comment_merge.swift:29:6: Func/is_doc6 RawComment=[/** is_doc6 IS_DOC_SINGLE */]
// CHECK-NEXT: comment_merge.swift:33:6: Func/is_doc7 RawComment=[/**\n * is_doc7 IS_DOC_SINGLE */]
// CHECK-NEXT: comment_merge.swift:38:6: Func/is_doc8 RawComment=[/**\n * is_doc8\n * IS_DOC_SINGLE */]
// CHECK-NEXT: comment_merge.swift:44:6: Func/is_doc9 RawComment=[/**\n * is_doc9\n * IS_DOC_SINGLE\n */]
// CHECK-NEXT: comment_merge.swift:47:6: Func/is_doc10 RawComment=[/// is_doc10 IS_DOC_SINGLE\n]
// CHECK-NEXT: comment_merge.swift:51:6: Func/is_doc11 RawComment=[/// Bbb. is_doc11 IS_DOC_SINGLE\n]
// CHECK-NEXT: comment_merge.swift:55:6: Func/not_doc12 RawComment=none
// CHECK-NEXT: comment_merge.swift:59:6: Func/not_doc13 RawComment=none
// CHECK-NEXT: comment_merge.swift:63:6: Func/is_doc14 RawComment=[/// is_doc14 IS_DOC_START\n/// IS_DOC_END\n]
// CHECK-NEXT: comment_merge.swift:68:6: Func/is_doc15 RawComment=[/// is_doc15 IS_DOC_START\n/// Aaa bbb ccc.\n/// IS_DOC_END\n]
// CHECK-NEXT: comment_merge.swift:73:6: Func/is_doc16 RawComment=[/// is_doc16 IS_DOC_START\n/** Aaa bbb ccc. *//// IS_DOC_END\n]
// CHECK-NEXT: comment_merge.swift:77:6: Func/is_doc17 RawComment=[/** Aaa is_doc17 IS_DOC_START *//** bbb *//// IS_DOC_END\n]
// CHECK-NEXT: comment_merge.swift:82:6: Func/is_doc18 RawComment=[/// is_doc18 IS_DOC_START IS_DOC_END\n]
// CHECK-NEXT: comment_merge.swift:93:6: Func/is_doc19 RawComment=[/// is_doc19 IS_DOC_START\n/** Aaa\n *\n * Bbb *//// Ccc\n/** Ddd\n * Eee IS_DOC_END\n */]