test/com/sun/javadoc/testTypeParams/TestTypeParameters.java

changeset 958
734144b6b22f
parent 798
4868a36f6fd8
child 1741
4c43e51433ba
equal deleted inserted replaced
957:46d720734db3 958:734144b6b22f
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
21 * questions. 21 * questions.
22 */ 22 */
23 23
24 /* 24 /*
25 * @test 25 * @test
26 * @bug 4927167 4974929 26 * @bug 4927167 4974929 7010344
27 * @summary When the type parameters are more than 10 characters in length, 27 * @summary When the type parameters are more than 10 characters in length,
28 * make sure there is a line break between type params and return type 28 * make sure there is a line break between type params and return type
29 * in member summary. 29 * in member summary. Also, test for type parameter links in package-summary and
30 * class-use pages. The class/annotation pages should check for type
31 * parameter links in the class/annotation signature section when -linksource is set.
30 * @author jamieh 32 * @author jamieh
31 * @library ../lib/ 33 * @library ../lib/
32 * @build JavadocTester 34 * @build JavadocTester TestTypeParameters
33 * @build TestTypeParameters
34 * @run main TestTypeParameters 35 * @run main TestTypeParameters
35 */ 36 */
36 37
37 public class TestTypeParameters extends JavadocTester { 38 public class TestTypeParameters extends JavadocTester {
38 39
39 //Test information. 40 //Test information.
40 private static final String BUG_ID = "4927167-4974929"; 41 private static final String BUG_ID = "4927167-4974929-7010344";
41 42
42 //Javadoc arguments. 43 //Javadoc arguments.
43 private static final String[] ARGS = new String[] { 44 private static final String[] ARGS1 = new String[]{
44 "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, 45 "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR,
45 "pkg" 46 "pkg"
47 };
48 private static final String[] ARGS2 = new String[]{
49 "-d", BUG_ID, "-linksource", "-source", "1.5", "-sourcepath", SRC_DIR,
50 "pkg"
46 }; 51 };
47 52
48 //Input for string search tests. 53 //Input for string search tests.
49 private static final String[][] TEST = 54 private static final String[][] TEST1 = {
50 {
51 {BUG_ID + FS + "pkg" + FS + "C.html", 55 {BUG_ID + FS + "pkg" + FS + "C.html",
52 "<td class=\"colFirst\"><code>&lt;W extends java.lang.String,V extends " + 56 "<td class=\"colFirst\"><code>&lt;W extends java.lang.String,V extends " +
53 "java.util.List&gt;&nbsp;<br>java.lang.Object</code></td>"}, 57 "java.util.List&gt;&nbsp;<br>java.lang.Object</code></td>"
58 },
54 {BUG_ID + FS + "pkg" + FS + "C.html", 59 {BUG_ID + FS + "pkg" + FS + "C.html",
55 "<code>&lt;T&gt;&nbsp;java.lang.Object</code>"}, 60 "<code>&lt;T&gt;&nbsp;java.lang.Object</code>"
61 },
56 {BUG_ID + FS + "pkg" + FS + "package-summary.html", 62 {BUG_ID + FS + "pkg" + FS + "package-summary.html",
57 "C&lt;E extends Parent&gt;"}, 63 "C</a>&lt;E extends <a href=\"../pkg/Parent.html\" " +
64 "title=\"class in pkg\">Parent</a>&gt;"
65 },
66 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "Foo4.html",
67 "<a href=\"../../pkg/ClassUseTest3.html\" title=\"class in pkg\">" +
68 "ClassUseTest3</a>&lt;T extends <a href=\"../../pkg/ParamTest2.html\" " +
69 "title=\"class in pkg\">ParamTest2</a>&lt;java.util.List&lt;? extends " +
70 "<a href=\"../../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>&gt;&gt;&gt;"
71 },
58 //Nested type parameters 72 //Nested type parameters
59 {BUG_ID + FS + "pkg" + FS + "C.html", 73 {BUG_ID + FS + "pkg" + FS + "C.html",
60 "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL + 74 "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
61 "<!-- -->" + NL + 75 "<!-- -->" + NL +
62 "</a>"}, 76 "</a>"
63 77 },
78 };
79 private static final String[][] TEST2 = {
80 {BUG_ID + FS + "pkg" + FS + "ClassUseTest3.html",
81 "public class <a href=\"../src-html/pkg/ClassUseTest3.html#line.28\">" +
82 "ClassUseTest3</a>&lt;T extends <a href=\"../pkg/ParamTest2.html\" " +
83 "title=\"class in pkg\">ParamTest2</a>&lt;java.util.List&lt;? extends " +
84 "<a href=\"../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>&gt;&gt;&gt;"
85 }
64 }; 86 };
65 private static final String[][] NEGATED_TEST = NO_TEST; 87 private static final String[][] NEGATED_TEST = NO_TEST;
66
67 88
68 /** 89 /**
69 * The entry point of the test. 90 * The entry point of the test.
70 * @param args the array of command line arguments. 91 * @param args the array of command line arguments.
71 */ 92 */
72 public static void main(String[] args) { 93 public static void main(String[] args) {
73 TestTypeParameters tester = new TestTypeParameters(); 94 TestTypeParameters tester = new TestTypeParameters();
74 run(tester, ARGS, TEST, NEGATED_TEST); 95 run(tester, ARGS1, TEST1, NEGATED_TEST);
96 run(tester, ARGS2, TEST2, NEGATED_TEST);
75 tester.printSummary(); 97 tester.printSummary();
76 } 98 }
77 99
78 /** 100 /**
79 * {@inheritDoc} 101 * {@inheritDoc}

mercurial