test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java
author jjg
Mon, 18 Jun 2018 13:52:30 -0700
changeset 50612 e10812a82a3b
parent 48654 36f58bd6269f
child 53097 2e82ca64b25d
permissions -rw-r--r--
8204330: Javadoc IllegalArgumentException: HTML special chars in constant value Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
     2
 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
50612
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
    26
 * @bug      4764045 8004825 8026567 8191030 8204330
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
 * @summary  This test ensures that the value tag works in all
48213
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
    28
 *           use cases, the tests are explained below.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 * @author   jamieh
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    30
 * @library ../lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    31
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    32
 * @build    JavadocTester
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * @run main TestValueTag
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
50612
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
    36
import java.io.IOException;
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
    37
import java.nio.file.Files;
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
    38
import java.nio.file.Path;
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
    39
import java.nio.file.Paths;
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
    40
import java.util.List;
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
    41
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
public class TestValueTag extends JavadocTester {
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
    public static void main(String... args) throws Exception {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
        TestValueTag tester = new TestValueTag();
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
        tester.runTests();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    49
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
    void test1() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
        javadoc("-d", "out1",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    52
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
                "-tag", "todo",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    54
                "pkg1", "pkg2");
41451
a847c7aa25a7 8151102: Cleanup javadoc exception handling
ksrini
parents: 36526
diff changeset
    55
        checkExit(Exit.ERROR);
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    57
        checkOutput("pkg1/Class1.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    58
                // Base case:  using @value on a constant.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    59
                "Result:  \"Test 1 passes\"",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    60
                // Retrieve value of constant in same class.
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    61
                "Result:  <a href=\"#TEST_2_PASSES\">\"Test 2 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    62
                "Result:  <a href=\"#TEST_3_PASSES\">\"Test 3 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    63
                "Result:  <a href=\"#TEST_4_PASSES\">\"Test 4 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    64
                "Result:  <a href=\"#TEST_5_PASSES\">\"Test 5 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    65
                "Result:  <a href=\"#TEST_6_PASSES\">\"Test 6 passes\"</a>");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    66
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    67
        checkOutput("pkg1/Class2.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    68
                // Retrieve value of constant in different class.
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    69
                "Result:  <a href=\"Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    70
                "Result:  <a href=\"Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    71
                "Result:  <a href=\"Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    72
                "Result:  <a href=\"Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    73
                "Result:  <a href=\"Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>",
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    74
                // Retrieve value of constant in different package
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    75
                "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    76
                "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    77
                "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    78
                "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    79
                "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    80
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    81
        checkOutput("pkg2/package-summary.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    82
                // Retrieve value of constant from a package page
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
    83
                "Result: <a href=\"Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>");
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    84
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    85
        checkOutput("pkg1/CustomTagUsage.html", true,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    86
                // Test @value tag used with custom tag.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    87
                "<dt><span class=\"simpleTagLabel\">Todo:</span></dt>\n" +
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    88
                "<dd>the value of this constant is 55.</dd>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    89
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    90
        checkOutput(Output.OUT, true,
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    91
                // Test @value errors printed due to invalid use or when used with
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    92
                // non-constant or with bad references.
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    93
                "error: value does not refer to a constant\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    94
                + "     * Result:  {@value TEST_12_ERROR}",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    95
                "error: {@value} not allowed here\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    96
                + "     * Result:  {@value}",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    97
                "error: value does not refer to a constant\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    98
                + "     * Result:  {@value NULL}",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    99
                "error: {@value} not allowed here\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   100
                + "     * Invalid (null): {@value}",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   101
                "error: {@value} not allowed here\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   102
                + "     * Invalid (non-constant field): {@value}",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   103
                "error: value does not refer to a constant\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   104
                + "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   105
                "error: reference not found\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   106
                + "     * Here is a bad value reference: {@value UnknownClass#unknownConstant}",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   107
                "error: {@value} not allowed here\n"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   108
                + "     * @todo the value of this constant is {@value}"
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   109
        );
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   110
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   111
        checkOutput("pkg1/Class1.html", false,
48213
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   112
                // Base case:  using @value on a constant.
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
   113
                "Result:  <a href=\"#TEST_12_ERROR\">\"Test 12 "
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   114
                + "generates an error message\"</a>");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   115
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   116
        checkForException();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   117
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   118
50612
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   119
    @Test
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   120
    void test2() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   121
        javadoc("-Xdoclint:none",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   122
                "-d", "out2",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   123
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   124
                "-tag", "todo",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   125
                "pkg1", "pkg2");
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   126
        checkExit(Exit.OK);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   127
        checkOutput(Output.OUT, true,
48213
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   128
                // Test @value warning printed when used with non-constant.
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   129
                "warning - @value tag (which references nonConstant) "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   130
                + "can only be used in constants.",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   131
                "warning - @value tag (which references NULL) "
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   132
                + "can only be used in constants.",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   133
                "warning - @value tag (which references TEST_12_ERROR) "
48213
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   134
                + "can only be used in constants.",
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   135
                // Test warning printed for bad reference.
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   136
                "warning - {@value UnknownClass#unknownConstant}"
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   137
                + " (referenced by @value tag) is an unknown reference."
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   138
        );
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   139
        checkForException();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   140
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   141
50612
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   142
    @Test
48213
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   143
    void test3() {
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   144
        javadoc("-d", "out3",
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   145
                "-sourcepath", testSrc,
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   146
                "pkg2", "pkg3");
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   147
        checkExit(Exit.OK);
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   148
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   149
        checkOrder("pkg3/RT.html",
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
   150
                "The value is <a href=\"#CONSTANT\">\"constant\"</a>.",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
   151
                "The value1 is <a href=\"#CONSTANT\">\"constant\"</a>.",
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 48213
diff changeset
   152
                "The value2 is <a href=\"#CONSTANT\">\"constant\"</a>.",
48213
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   153
                "The value3 is <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">"
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   154
                + "\"Test 12 passes\"</a>.");
50612
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   155
        checkForException();
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   156
    }
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   157
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   158
    @Test
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   159
    void test4() throws IOException {
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   160
        Path base = Paths.get("test4");
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   161
        Path src = base.resolve("src");
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   162
        Files.createDirectories(src.resolve("p"));
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   163
        Files.write(src.resolve("p").resolve("C.java"), List.of(
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   164
                "package p;",
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   165
                "/** This class defines specialChars: {@value C#specialChars}. */",
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   166
                "public class C {",
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   167
                "    /** The value is {@value}. */",
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   168
                "    public static final String specialChars = \"abc < def & ghi > jkl\";",
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   169
                "}"));
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   170
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   171
        javadoc("-d", base.resolve("out").toString(),
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   172
                "-sourcepath", src.toString(),
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   173
                "p");
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   174
        checkExit(Exit.OK);
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   175
        checkOutput("p/C.html", false,
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   176
                "The value is \"abc < def & ghi > jkl\".");
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   177
        checkOutput("p/C.html", true,
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   178
                "The value is \"abc &lt; def &amp; ghi &gt; jkl\".");
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   179
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   180
        checkForException();
48213
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   181
    }
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   182
59696a3595bd 8191030: @value Tags are not resolved by javadoc 9.
ksrini
parents: 47216
diff changeset
   183
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   184
    void checkForException() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   185
        checkOutput(Output.STDERR, false, "DocletAbortException");
50612
e10812a82a3b 8204330: Javadoc IllegalArgumentException: HTML special chars in constant value
jjg
parents: 48654
diff changeset
   186
        checkOutput(Output.STDERR, false, "IllegalArgumentException");
20264
f7527e6828bb 8004825: javadoc crash DocletAbortException
bpatel
parents: 17566
diff changeset
   187
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
}