langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java
changeset 24072 e7549dcbc4af
parent 24065 fc4022e50129
child 24399 af1a0220d0fa
equal deleted inserted replaced
24071:b0845717434e 24072:e7549dcbc4af
    32  * @run main TestValueTag
    32  * @run main TestValueTag
    33  */
    33  */
    34 
    34 
    35 public class TestValueTag extends JavadocTester {
    35 public class TestValueTag extends JavadocTester {
    36 
    36 
    37     //Test information.
       
    38     private static final String BUG_ID = "4764045";
       
    39 
       
    40     //Javadoc arguments.
    37     //Javadoc arguments.
    41     private static final String[] ARGS =
    38     private static final String[] ARGS =
    42         new String[] {
    39         new String[] {
    43             "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
    40             "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-tag",
    44             "todo", "pkg1", "pkg2"
    41             "todo", "pkg1", "pkg2"
    45         };
    42         };
    46 
    43 
    47     private static final String[] ARGS1 =
    44     private static final String[] ARGS1 =
    48         new String[] {
    45         new String[] {
    49             "-Xdoclint:none",
    46             "-Xdoclint:none",
    50             "-d", BUG_ID + "-1", "-sourcepath", SRC_DIR, "-tag",
    47             "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-tag",
    51             "todo", "pkg1", "pkg2"
    48             "todo", "pkg1", "pkg2"
    52         };
    49         };
    53 
    50 
    54     //Input for string search tests.
    51     //Input for string search tests.
    55     private static final String[][] TEST = {
    52     private static final String[][] TEST = {
    56         //Base case:  using @value on a constant.
    53         //Base case:  using @value on a constant.
    57         {BUG_ID + "/pkg1/Class1.html",
    54         { "pkg1/Class1.html",
    58             "Result:  \"Test 1 passes\""},
    55             "Result:  \"Test 1 passes\""},
    59         //Retrieve value of constant in same class.
    56         //Retrieve value of constant in same class.
    60         {BUG_ID + "/pkg1/Class1.html",
    57         { "pkg1/Class1.html",
    61             "Result:  <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
    58             "Result:  <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
    62         {BUG_ID + "/pkg1/Class1.html",
    59         { "pkg1/Class1.html",
    63             "Result:  <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
    60             "Result:  <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
    64         {BUG_ID + "/pkg1/Class1.html",
    61         { "pkg1/Class1.html",
    65             "Result:  <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
    62             "Result:  <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
    66         {BUG_ID + "/pkg1/Class1.html",
    63         { "pkg1/Class1.html",
    67             "Result:  <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
    64             "Result:  <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
    68         {BUG_ID + "/pkg1/Class1.html",
    65         { "pkg1/Class1.html",
    69             "Result:  <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
    66             "Result:  <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
    70         //Retrieve value of constant in different class.
    67         //Retrieve value of constant in different class.
    71         {BUG_ID + "/pkg1/Class2.html",
    68         { "pkg1/Class2.html",
    72             "Result:  <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
    69             "Result:  <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
    73         {BUG_ID + "/pkg1/Class2.html",
    70         { "pkg1/Class2.html",
    74             "Result:  <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
    71             "Result:  <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
    75         {BUG_ID + "/pkg1/Class2.html",
    72         { "pkg1/Class2.html",
    76             "Result:  <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
    73             "Result:  <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
    77         {BUG_ID + "/pkg1/Class2.html",
    74         { "pkg1/Class2.html",
    78             "Result:  <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
    75             "Result:  <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
    79         {BUG_ID + "/pkg1/Class2.html",
    76         { "pkg1/Class2.html",
    80             "Result:  <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
    77             "Result:  <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
    81         //Retrieve value of constant in different package
    78         //Retrieve value of constant in different package
    82         {BUG_ID + "/pkg1/Class2.html",
    79         { "pkg1/Class2.html",
    83             "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
    80             "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
    84         {BUG_ID + "/pkg1/Class2.html",
    81         { "pkg1/Class2.html",
    85             "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
    82             "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
    86         {BUG_ID + "/pkg1/Class2.html",
    83         { "pkg1/Class2.html",
    87             "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
    84             "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
    88         {BUG_ID + "/pkg1/Class2.html",
    85         { "pkg1/Class2.html",
    89             "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
    86             "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
    90         {BUG_ID + "/pkg1/Class2.html",
    87         { "pkg1/Class2.html",
    91             "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
    88             "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
    92         //Retrieve value of constant from a package page
    89         //Retrieve value of constant from a package page
    93         {BUG_ID + "/pkg2/package-summary.html",
    90         { "pkg2/package-summary.html",
    94             "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
    91             "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
    95         //Test @value tag used with custom tag.
    92         //Test @value tag used with custom tag.
    96         {BUG_ID + "/pkg1/CustomTagUsage.html",
    93         { "pkg1/CustomTagUsage.html",
    97             "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" +
    94             "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" +
    98                 "<dd>the value of this constant is 55.</dd>"},
    95                 "<dd>the value of this constant is 55.</dd>"},
    99         //Test @value errors printed dues to invalid use or when used with
    96         //Test @value errors printed dues to invalid use or when used with
   100         //non-constant or with bad references.
    97         //non-constant or with bad references.
   101         {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
    98         {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
   142         {WARNING_OUTPUT,"warning - @value tag cannot be used here."
   139         {WARNING_OUTPUT,"warning - @value tag cannot be used here."
   143         }
   140         }
   144     };
   141     };
   145     private static final String[][] NEGATED_TEST = {
   142     private static final String[][] NEGATED_TEST = {
   146         //Base case:  using @value on a constant.
   143         //Base case:  using @value on a constant.
   147         {BUG_ID + "/pkg1/Class1.html",
   144         { "pkg1/Class1.html",
   148             "Result:  <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " +
   145             "Result:  <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " +
   149             "generates an error message\"</a>"},
   146             "generates an error message\"</a>"},
   150     };
   147     };
   151 
   148 
   152     /**
   149     /**
   165     public static void checkForException(TestValueTag tester) {
   162     public static void checkForException(TestValueTag tester) {
   166         if (tester.getErrorOutput().contains("DocletAbortException")) {
   163         if (tester.getErrorOutput().contains("DocletAbortException")) {
   167             throw new AssertionError("javadoc threw DocletAbortException");
   164             throw new AssertionError("javadoc threw DocletAbortException");
   168         }
   165         }
   169     }
   166     }
   170 
       
   171     /**
       
   172      * {@inheritDoc}
       
   173      */
       
   174     public String getBugId() {
       
   175         return BUG_ID;
       
   176     }
       
   177 
       
   178     /**
       
   179      * {@inheritDoc}
       
   180      */
       
   181     public String getBugName() {
       
   182         return getClass().getName();
       
   183     }
       
   184 }
   167 }