Fri, 24 Apr 2020 03:58:51 +0100
Merge
1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 /*
25 * @test
26 * @bug 7021614
27 * @summary extend com.sun.source API to support parsing javadoc comments
28 * @build DocCommentTester
29 * @run main DocCommentTester AttrTest.java
30 */
32 class AttrTest {
33 /**
34 * <a name=unquoted>foo</a>
35 */
36 void unquoted_attr() { }
37 /*
38 DocComment[DOC_COMMENT, pos:1
39 firstSentence: 3
40 StartElement[START_ELEMENT, pos:1
41 name:a
42 attributes: 1
43 Attribute[ATTRIBUTE, pos:4
44 name: name
45 vkind: UNQUOTED
46 value: 1
47 Text[TEXT, pos:9, unquoted]
48 ]
49 ]
50 Text[TEXT, pos:18, foo]
51 EndElement[END_ELEMENT, pos:21, a]
52 body: empty
53 block tags: empty
54 ]
55 */
57 /**
58 * <a name="double_quoted">foo</a>
59 */
60 void double_quoted_attr() { }
61 /*
62 DocComment[DOC_COMMENT, pos:1
63 firstSentence: 3
64 StartElement[START_ELEMENT, pos:1
65 name:a
66 attributes: 1
67 Attribute[ATTRIBUTE, pos:4
68 name: name
69 vkind: DOUBLE
70 value: 1
71 Text[TEXT, pos:10, double_quoted]
72 ]
73 ]
74 Text[TEXT, pos:25, foo]
75 EndElement[END_ELEMENT, pos:28, a]
76 body: empty
77 block tags: empty
78 ]
79 */
81 /**
82 * <a name='single_quoted'>foo</a>
83 */
84 void single_quoted_attr() { }
85 /*
86 DocComment[DOC_COMMENT, pos:1
87 firstSentence: 3
88 StartElement[START_ELEMENT, pos:1
89 name:a
90 attributes: 1
91 Attribute[ATTRIBUTE, pos:4
92 name: name
93 vkind: SINGLE
94 value: 1
95 Text[TEXT, pos:10, single_quoted]
96 ]
97 ]
98 Text[TEXT, pos:25, foo]
99 EndElement[END_ELEMENT, pos:28, a]
100 body: empty
101 block tags: empty
102 ]
103 */
105 /**
106 * <hr size="3">
107 */
108 void numeric_attr() { }
109 /*
110 DocComment[DOC_COMMENT, pos:1
111 firstSentence: 1
112 StartElement[START_ELEMENT, pos:1
113 name:hr
114 attributes: 1
115 Attribute[ATTRIBUTE, pos:5
116 name: size
117 vkind: DOUBLE
118 value: 1
119 Text[TEXT, pos:11, 3]
120 ]
121 ]
122 body: empty
123 block tags: empty
124 ]
125 */
127 /**
128 * <a href="{@docRoot}/index.html">
129 */
130 void docRoot_attr() { }
131 /*
132 DocComment[DOC_COMMENT, pos:1
133 firstSentence: 1
134 StartElement[START_ELEMENT, pos:1
135 name:a
136 attributes: 1
137 Attribute[ATTRIBUTE, pos:4
138 name: href
139 vkind: DOUBLE
140 value: 2
141 DocRoot[DOC_ROOT, pos:10]
142 Text[TEXT, pos:20, /index.html]
143 ]
144 ]
145 body: empty
146 block tags: empty
147 ]
148 */
150 /**
151 * <a name="abc"def">
152 */
153 void entity_attr() { }
154 /*
155 DocComment[DOC_COMMENT, pos:1
156 firstSentence: 1
157 StartElement[START_ELEMENT, pos:1
158 name:a
159 attributes: 1
160 Attribute[ATTRIBUTE, pos:4
161 name: name
162 vkind: DOUBLE
163 value: 3
164 Text[TEXT, pos:10, abc]
165 Entity[ENTITY, pos:13, quot]
166 Text[TEXT, pos:19, def]
167 ]
168 ]
169 body: empty
170 block tags: empty
171 ]
172 */
174 /**
175 * <hr noshade>
176 */
177 void no_value_attr() { }
178 /*
179 DocComment[DOC_COMMENT, pos:1
180 firstSentence: 1
181 StartElement[START_ELEMENT, pos:1
182 name:hr
183 attributes: 1
184 Attribute[ATTRIBUTE, pos:5
185 name: noshade
186 vkind: EMPTY
187 value: null
188 ]
189 ]
190 body: empty
191 block tags: empty
192 ]
193 */
195 /**
196 * abc <hr size='3'/>
197 */
198 void self_closing_attr_1() { }
199 /*
200 DocComment[DOC_COMMENT, pos:1
201 firstSentence: 2
202 Text[TEXT, pos:1, abc_]
203 StartElement[START_ELEMENT, pos:5
204 name:hr
205 attributes: 1
206 Attribute[ATTRIBUTE, pos:9
207 name: size
208 vkind: SINGLE
209 value: 1
210 Text[TEXT, pos:15, 3]
211 ]
212 ]
213 body: empty
214 block tags: empty
215 ]
216 */
218 /**
219 * abc <hr size=3 />
220 */
221 void self_closing_attr_2() { }
222 /*
223 DocComment[DOC_COMMENT, pos:1
224 firstSentence: 2
225 Text[TEXT, pos:1, abc_]
226 StartElement[START_ELEMENT, pos:5
227 name:hr
228 attributes: 1
229 Attribute[ATTRIBUTE, pos:9
230 name: size
231 vkind: UNQUOTED
232 value: 1
233 Text[TEXT, pos:14, 3]
234 ]
235 ]
236 body: empty
237 block tags: empty
238 ]
239 */
241 /**
242 * abc <hr size="3
243 */
244 void unterminated_attr_eoi() { }
245 /*
246 DocComment[DOC_COMMENT, pos:1
247 firstSentence: 3
248 Text[TEXT, pos:1, abc_]
249 Erroneous[ERRONEOUS, pos:5
250 code: compiler.err.dc.malformed.html
251 body: <
252 ]
253 Text[TEXT, pos:6, hr_size="3]
254 body: empty
255 block tags: empty
256 ]
257 */
259 /**
260 * abc <hr size="3
261 * @author jjg
262 */
263 void unterminated_attr_block() { }
264 /*
265 DocComment[DOC_COMMENT, pos:1
266 firstSentence: 3
267 Text[TEXT, pos:1, abc_]
268 Erroneous[ERRONEOUS, pos:5
269 code: compiler.err.dc.malformed.html
270 body: <
271 ]
272 Text[TEXT, pos:6, hr_size="3]
273 body: empty
274 block tags: 1
275 Author[AUTHOR, pos:18
276 name: 1
277 Text[TEXT, pos:26, jjg]
278 ]
279 ]
280 */
281 }