TestLiteralCodeInPre.java revision 2365:6207608205b8
1/* 2 * Copyright (c) 2002, 2014, 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 */ 23 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 */ 32 33public class TestLiteralCodeInPre extends JavadocTester { 34 35 //Test information. 36 private static final String BUG_ID = "8002387-8014636"; 37 private static final String OUTPUT_DIR = BUG_ID; 38 39 //Javadoc arguments. 40 private static final String[] ARGS = new String[] { 41 "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-Xdoclint:none", "pkg" 42 }; 43 44 //Input for string search tests. 45 private static final String[][] TEST = { 46 { BUG_ID + "/pkg/Test.html", 47 "no_pre()</pre>\n" + 48 "<div class=\"block\">abc<code>def</code>ghi</div>" }, 49 { BUG_ID + "/pkg/Test.html", 50 "no_pre_extra_whitespace()</pre>\n" + 51 "<div class=\"block\">abc<code>def </code>ghi</div>" }, 52 { BUG_ID + "/pkg/Test.html", 53 "in_pre()</pre>\n" + 54 "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>" }, 55 { BUG_ID + "/pkg/Test.html", 56 "pre_after_text()</pre>\n" + 57 "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>" }, 58 { BUG_ID + "/pkg/Test.html", 59 "after_pre()</pre>\n" + 60 "<div class=\"block\">xyz <pre> pqr </pre> abc<code>def </code>ghi</div>" }, 61 { BUG_ID + "/pkg/Test.html", 62 "back_in_pre()</pre>\n" + 63 "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>" }, 64 { BUG_ID + "/pkg/Test.html", 65 "typical_usage_code()</pre>\n" + 66 "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" + 67 " Example: <pre><code>\n" + 68 " line 1 <T> void m(T t) {\n" + 69 " line 2 // do something with T\n" + 70 " line 3 }\n" + 71 " </code></pre>\n" + 72 " and so it goes.</div>" }, 73 { BUG_ID + "/pkg/Test.html", 74 "typical_usage_literal()</pre>\n" + 75 "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" + 76 " Example: <pre>\n" + 77 " line 1 <T> void m(T t) {\n" + 78 " line 2 // do something with T\n" + 79 " line 3 }\n" + 80 " </pre>\n" + 81 " and so it goes.</div>" }, 82 { BUG_ID + "/pkg/Test.html", 83 "recommended_usage_literal()</pre>\n" + 84 "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" + 85 " Example: <pre>\n" + 86 " line 1 <T> void m(T t) {\n" + 87 " line 2 // do something with T\n" + 88 " line 3 } </pre>\n" + 89 " and so it goes.</div>" } 90 }; 91 92 private static final String[][] NEGATED_TEST = NO_TEST; 93 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 } 103 104 /** 105 * {@inheritDoc} 106 */ 107 public String getBugId() { 108 return BUG_ID; 109 } 110 111 /** 112 * {@inheritDoc} 113 */ 114 public String getBugName() { 115 return getClass().getName(); 116 } 117} 118