langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java
changeset 24399 af1a0220d0fa
parent 24217 25b12d4d4192
child 30730 d3ce7619db2c
equal deleted inserted replaced
24398:601a611d0aee 24399:af1a0220d0fa
    28  *           Make sure that only warnings/errors are printed when quiet is used.
    28  *           Make sure that only warnings/errors are printed when quiet is used.
    29  *           Make sure that links to private/unincluded methods do not cause
    29  *           Make sure that links to private/unincluded methods do not cause
    30  *           a "link unresolved" warning.
    30  *           a "link unresolved" warning.
    31  *           Make sure error message starts with "error -".
    31  *           Make sure error message starts with "error -".
    32  * @author   jamieh
    32  * @author   jamieh
    33  * @library  ../lib/
    33  * @library  ../lib
    34  * @build    JavadocTester
    34  * @build    JavadocTester
    35  * @build    TestWarnings
       
    36  * @run main TestWarnings
    35  * @run main TestWarnings
    37  */
    36  */
    38 
    37 
    39 public class TestWarnings extends JavadocTester {
    38 public class TestWarnings extends JavadocTester {
       
    39     public static void main(String... args) throws Exception  {
       
    40         TestWarnings tester = new TestWarnings();
       
    41         tester.runTests();
       
    42     }
    40 
    43 
    41     //Javadoc arguments.
    44     @Test
    42     private static final String[] ARGS = new String[] {
    45     void testDefault() {
    43         "-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg"
    46         javadoc("-Xdoclint:none",
    44     };
    47                 "-d", "out-default",
       
    48                 "-sourcepath", testSrc,
       
    49                 "pkg");
       
    50         checkExit(Exit.FAILED);  // TODO: investigate; suspect bad input HTML
    45 
    51 
    46     private static final String[] ARGS2 = new String[] {
    52         checkOutput(Output.WARNING, true,
    47         "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-private", "-sourcepath", SRC_DIR,
    53                 "X.java:11: warning - Missing closing '}' character for inline tag");
    48         "pkg"
    54         checkOutput(Output.ERROR, true,
    49     };
    55                 "package.html: error - Body tag missing from HTML");
    50 
    56 
    51     //Input for string search tests.
    57         checkOutput("pkg/X.html", false,
    52     private static final String[][] TEST = {
    58                 "can't find m()");
    53         {WARNING_OUTPUT,
    59         checkOutput("pkg/X.html", false,
    54             "X.java:11: warning - Missing closing '}' character for inline tag"},
    60                 "can't find X()");
    55         {ERROR_OUTPUT,
    61         checkOutput("pkg/X.html", false,
    56             "package.html: error - Body tag missing from HTML"},
    62                 "can't find f");
       
    63     }
    57 
    64 
    58     };
    65     @Test
    59     private static final String[][] NEGATED_TEST = {
    66     void testPrivate() {
    60         { "pkg/X.html", "can't find m()"},
    67         javadoc("-Xdoclint:none",
    61         { "pkg/X.html", "can't find X()"},
    68                 "-d", "out-private",
    62         { "pkg/X.html", "can't find f"},
    69                 "-private",
    63     };
    70                 "-sourcepath", testSrc,
       
    71                 "pkg");
       
    72         checkExit(Exit.FAILED);  // TODO: investigate; suspect bad input HTML
    64 
    73 
    65     private static final String[][] TEST2 = {
    74         checkOutput("pkg/X.html", true,
    66         { "pkg/X.html",
    75             "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>",
    67             "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>"},
    76             "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>",
    68         { "pkg/X.html",
    77             "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>");
    69             "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>"},
       
    70         { "pkg/X.html",
       
    71             "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"},
       
    72     };
       
    73 
       
    74     /**
       
    75      * The entry point of the test.
       
    76      * @param args the array of command line arguments.
       
    77      */
       
    78     public static void main(String[] args) {
       
    79         TestWarnings tester = new TestWarnings();
       
    80         tester.run(ARGS, TEST, NEGATED_TEST);
       
    81         tester.run(ARGS2, TEST2, NO_TEST);
       
    82         tester.printSummary();
       
    83     }
    78     }
    84 }
    79 }