Wed, 08 Oct 2014 12:38:55 -0700
Added tag jdk8u40-b09 for changeset 8bb38a350722
1 /*
2 * Copyright (c) 2002, 2013, 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 8002387 8014636
27 * @summary Improve rendered HTML formatting for {@code}
28 * @library ../lib/
29 * @build JavadocTester TestLiteralCodeInPre
30 * @run main TestLiteralCodeInPre
31 */
33 public class TestLiteralCodeInPre extends JavadocTester {
35 //Test information.
36 private static final String BUG_ID = "8002387-8014636";
37 private static final String OUTPUT_DIR = BUG_ID;
39 //Javadoc arguments.
40 private static final String[] ARGS = new String[] {
41 "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-Xdoclint:none", "pkg"
42 };
44 //Input for string search tests.
45 private static final String[][] TEST = {
46 { BUG_ID + FS + "pkg" + FS + "Test.html",
47 "no_pre()</pre>" + NL +
48 "<div class=\"block\">abc<code>def</code>ghi</div>" },
49 { BUG_ID + FS + "pkg" + FS + "Test.html",
50 "no_pre_extra_whitespace()</pre>" + NL +
51 "<div class=\"block\">abc<code>def </code>ghi</div>" },
52 { BUG_ID + FS + "pkg" + FS + "Test.html",
53 "in_pre()</pre>" + NL +
54 "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>" },
55 { BUG_ID + FS + "pkg" + FS + "Test.html",
56 "pre_after_text()</pre>" + NL +
57 "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>" },
58 { BUG_ID + FS + "pkg" + FS + "Test.html",
59 "after_pre()</pre>" + NL +
60 "<div class=\"block\">xyz <pre> pqr </pre> abc<code>def </code>ghi</div>" },
61 { BUG_ID + FS + "pkg" + FS + "Test.html",
62 "back_in_pre()</pre>" + NL +
63 "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>" },
64 { BUG_ID + FS + "pkg" + FS + "Test.html",
65 "typical_usage_code()</pre>" + NL +
66 "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit." + NL +
67 " Example: <pre><code>" + NL +
68 " line 1 <T> void m(T t) {" + NL +
69 " line 2 // do something with T" + NL +
70 " line 3 }" + NL +
71 " </code></pre>" + NL +
72 " and so it goes.</div>" },
73 { BUG_ID + FS + "pkg" + FS + "Test.html",
74 "typical_usage_literal()</pre>" + NL +
75 "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit." + NL +
76 " Example: <pre>" + NL +
77 " line 1 <T> void m(T t) {" + NL +
78 " line 2 // do something with T" + NL +
79 " line 3 }" + NL +
80 " </pre>" + NL +
81 " and so it goes.</div>" },
82 { BUG_ID + FS + "pkg" + FS + "Test.html",
83 "recommended_usage_literal()</pre>" + NL +
84 "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit." + NL +
85 " Example: <pre>" + NL +
86 " line 1 <T> void m(T t) {" + NL +
87 " line 2 // do something with T" + NL +
88 " line 3 } </pre>" + NL +
89 " and so it goes.</div>" }
90 };
92 private static final String[][] NEGATED_TEST = NO_TEST;
94 /**
95 * The entry point of the test.
96 * @param args the array of command line arguments.
97 */
98 public static void main(String[] args) {
99 TestLiteralCodeInPre tester = new TestLiteralCodeInPre();
100 run(tester, ARGS, TEST, NEGATED_TEST);
101 tester.printSummary();
102 }
104 /**
105 * {@inheritDoc}
106 */
107 public String getBugId() {
108 return BUG_ID;
109 }
111 /**
112 * {@inheritDoc}
113 */
114 public String getBugName() {
115 return getClass().getName();
116 }
117 }