langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java
changeset 23971 f5ff1f5a8dee
parent 21478 fa4c7cda1b41
child 24065 fc4022e50129
equal deleted inserted replaced
23970:76f4acb11952 23971:f5ff1f5a8dee
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2014, 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.
    52         };
    52         };
    53 
    53 
    54     //Input for string search tests.
    54     //Input for string search tests.
    55     private static final String[][] TEST = {
    55     private static final String[][] TEST = {
    56         //Base case:  using @value on a constant.
    56         //Base case:  using @value on a constant.
    57         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    57         {BUG_ID + "/pkg1/Class1.html",
    58             "Result:  \"Test 1 passes\""},
    58             "Result:  \"Test 1 passes\""},
    59         //Retrieve value of constant in same class.
    59         //Retrieve value of constant in same class.
    60         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    60         {BUG_ID + "/pkg1/Class1.html",
    61             "Result:  <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
    61             "Result:  <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
    62         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    62         {BUG_ID + "/pkg1/Class1.html",
    63             "Result:  <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
    63             "Result:  <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
    64         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    64         {BUG_ID + "/pkg1/Class1.html",
    65             "Result:  <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
    65             "Result:  <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
    66         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    66         {BUG_ID + "/pkg1/Class1.html",
    67             "Result:  <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
    67             "Result:  <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
    68         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    68         {BUG_ID + "/pkg1/Class1.html",
    69             "Result:  <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
    69             "Result:  <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
    70         //Retrieve value of constant in different class.
    70         //Retrieve value of constant in different class.
    71         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    71         {BUG_ID + "/pkg1/Class2.html",
    72             "Result:  <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
    72             "Result:  <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
    73         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    73         {BUG_ID + "/pkg1/Class2.html",
    74             "Result:  <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
    74             "Result:  <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
    75         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    75         {BUG_ID + "/pkg1/Class2.html",
    76             "Result:  <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
    76             "Result:  <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
    77         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    77         {BUG_ID + "/pkg1/Class2.html",
    78             "Result:  <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
    78             "Result:  <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
    79         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    79         {BUG_ID + "/pkg1/Class2.html",
    80             "Result:  <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
    80             "Result:  <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
    81         //Retrieve value of constant in different package
    81         //Retrieve value of constant in different package
    82         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    82         {BUG_ID + "/pkg1/Class2.html",
    83             "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
    83             "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
    84         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    84         {BUG_ID + "/pkg1/Class2.html",
    85             "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
    85             "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
    86         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    86         {BUG_ID + "/pkg1/Class2.html",
    87             "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
    87             "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
    88         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    88         {BUG_ID + "/pkg1/Class2.html",
    89             "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
    89             "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
    90         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    90         {BUG_ID + "/pkg1/Class2.html",
    91             "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
    91             "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
    92         //Retrieve value of constant from a package page
    92         //Retrieve value of constant from a package page
    93         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
    93         {BUG_ID + "/pkg2/package-summary.html",
    94             "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
    94             "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
    95         //Test @value tag used with custom tag.
    95         //Test @value tag used with custom tag.
    96         {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
    96         {BUG_ID + "/pkg1/CustomTagUsage.html",
    97             "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>" + NL +
    97             "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" +
    98                 "<dd>the value of this constant is 55.</dd>"},
    98                 "<dd>the value of this constant is 55.</dd>"},
    99         //Test @value errors printed dues to invalid use or when used with
    99         //Test @value errors printed dues to invalid use or when used with
   100         //non-constant or with bad references.
   100         //non-constant or with bad references.
   101         {ERROR_OUTPUT,"error: value does not refer to a constant" + NL +
   101         {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
   102             "     * Result:  {@value TEST_12_ERROR}"
   102             "     * Result:  {@value TEST_12_ERROR}"
   103         },
   103         },
   104         {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
   104         {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
   105             "     * Result:  {@value}"
   105             "     * Result:  {@value}"
   106         },
   106         },
   107         {ERROR_OUTPUT,"error: value does not refer to a constant" + NL +
   107         {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
   108             "     * Result:  {@value NULL}"
   108             "     * Result:  {@value NULL}"
   109         },
   109         },
   110         {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
   110         {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
   111             "     * Invalid (null): {@value}"
   111             "     * Invalid (null): {@value}"
   112         },
   112         },
   113         {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
   113         {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
   114             "     * Invalid (non-constant field): {@value}"
   114             "     * Invalid (non-constant field): {@value}"
   115         },
   115         },
   116         {ERROR_OUTPUT,"error: value does not refer to a constant" + NL +
   116         {ERROR_OUTPUT,"error: value does not refer to a constant\n" +
   117             "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
   117             "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
   118         },
   118         },
   119         {ERROR_OUTPUT,"error: reference not found" + NL +
   119         {ERROR_OUTPUT,"error: reference not found\n" +
   120             "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
   120             "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}"
   121         },
   121         },
   122         {ERROR_OUTPUT,"error: {@value} not allowed here" + NL +
   122         {ERROR_OUTPUT,"error: {@value} not allowed here\n" +
   123             "     * @todo the value of this constant is {@value}"
   123             "     * @todo the value of this constant is {@value}"
   124         }
   124         }
   125     };
   125     };
   126     private static final String[][] TEST1 = {
   126     private static final String[][] TEST1 = {
   127         //Test @value warning printed when used with non-constant.
   127         //Test @value warning printed when used with non-constant.
   142         {WARNING_OUTPUT,"warning - @value tag cannot be used here."
   142         {WARNING_OUTPUT,"warning - @value tag cannot be used here."
   143         }
   143         }
   144     };
   144     };
   145     private static final String[][] NEGATED_TEST = {
   145     private static final String[][] NEGATED_TEST = {
   146         //Base case:  using @value on a constant.
   146         //Base case:  using @value on a constant.
   147         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
   147         {BUG_ID + "/pkg1/Class1.html",
   148             "Result:  <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " +
   148             "Result:  <a href=\"../pkg1/Class1.html#TEST_12_ERROR\">\"Test 12 " +
   149             "generates an error message\"</a>"},
   149             "generates an error message\"</a>"},
   150     };
   150     };
   151 
   151 
   152     /**
   152     /**