langtools/test/com/sun/javadoc/testSinceTag/TestSinceTag.java
changeset 24399 af1a0220d0fa
parent 24217 25b12d4d4192
child 30730 d3ce7619db2c
equal deleted inserted replaced
24398:601a611d0aee 24399:af1a0220d0fa
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug      7180906 8026567
    26  * @bug      7180906 8026567
    27  * @summary  Test to make sure that the since tag works correctly
    27  * @summary  Test to make sure that the since tag works correctly
    28  * @author   Bhavesh Patel
    28  * @author   Bhavesh Patel
    29  * @library  ../lib/
    29  * @library  ../lib
    30  * @build    JavadocTester TestSinceTag
    30  * @build    JavadocTester
    31  * @run main TestSinceTag
    31  * @run main TestSinceTag
    32  */
    32  */
    33 
    33 
    34 public class TestSinceTag extends JavadocTester {
    34 public class TestSinceTag extends JavadocTester {
    35 
    35 
    36     //Javadoc arguments.
    36     public static void main(String... args) throws Exception {
    37     private static final String[] ARGS1 = new String[] {
       
    38         "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"
       
    39     };
       
    40 
       
    41     private static final String[] ARGS2 = new String[] {
       
    42         "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-nosince", "pkg1"
       
    43     };
       
    44 
       
    45     //Input for string search tests.
       
    46     private static final String[][] TEST = {
       
    47         { "pkg1/C1.html",
       
    48             "<dl>\n" +
       
    49             "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
       
    50             "<dd>JDK1.0</dd>"
       
    51         },
       
    52         { "serialized-form.html",
       
    53             "<dl>\n" +
       
    54             "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
       
    55             "<dd>1.4</dd>"
       
    56         }
       
    57     };
       
    58 
       
    59     /**
       
    60      * The entry point of the test.
       
    61      * @param args the array of command line arguments.
       
    62      */
       
    63     public static void main(String[] args) {
       
    64         TestSinceTag tester = new TestSinceTag();
    37         TestSinceTag tester = new TestSinceTag();
    65         tester.run(ARGS1, TEST, NO_TEST);
    38         tester.runTests();
    66         tester.run(ARGS2, NO_TEST, TEST);
       
    67         tester.printSummary();
    39         tester.printSummary();
    68     }
    40     }
       
    41 
       
    42     @Test
       
    43     void testSince() {
       
    44         javadoc("-d", "out-since",
       
    45                 "-sourcepath", testSrc,
       
    46                 "pkg1");
       
    47         checkExit(Exit.FAILED); // TODO: investigate
       
    48 
       
    49         checkSince(true);
       
    50     }
       
    51 
       
    52     @Test
       
    53     void testNoSince() {
       
    54         javadoc("-d", "out-nosince",
       
    55                 "-sourcepath", testSrc,
       
    56                 "-nosince",
       
    57                 "pkg1");
       
    58         checkExit(Exit.FAILED); // TODO: investigate
       
    59 
       
    60         checkSince(false);
       
    61     }
       
    62 
       
    63     void checkSince(boolean on) {
       
    64         checkOutput("pkg1/C1.html", on,
       
    65                 "<dl>\n"
       
    66                 + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
       
    67                 + "<dd>JDK1.0</dd>");
       
    68 
       
    69         checkOutput("serialized-form.html", on,
       
    70                 "<dl>\n"
       
    71                 + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
       
    72                 + "<dd>1.4</dd>");
       
    73     }
    69 }
    74 }