langtools/test/com/sun/javadoc/testCustomTag/TestCustomTag.java
author jjg
Tue, 22 Apr 2014 17:57:40 -0700
changeset 24072 e7549dcbc4af
parent 24065 fc4022e50129
child 24399 af1a0220d0fa
permissions -rw-r--r--
8040903: Clean up use of BUG_ID in javadoc tests Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     1
/*
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 21500
diff changeset
     2
 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     4
 *
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     7
 * published by the Free Software Foundation.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     8
 *
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    13
 * accompanied this code).
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    14
 *
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    18
 *
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    21
 * questions.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    22
 */
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    23
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    24
/*
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    25
 * @test
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    26
 * @bug      8006248
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    27
 * @summary  Test custom tag. Verify that an unknown tag generates appropriate warnings.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    28
 * @author   Bhavesh Patel
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    29
 * @library  ../lib/
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    30
 * @build    JavadocTester taglets.CustomTag TestCustomTag
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    31
 * @run main TestCustomTag
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    32
 */
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    33
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    34
public class TestCustomTag extends JavadocTester {
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    35
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    36
    //Javadoc arguments.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    37
    private static final String[] ARGS = new String[] {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    38
        "-Xdoclint:none", "-d", OUTPUT_DIR, "-tagletpath", SRC_DIR,
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    39
        "-taglet", "taglets.CustomTag", "-sourcepath",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 21500
diff changeset
    40
        SRC_DIR, SRC_DIR + "/TagTestClass.java"
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    41
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    42
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    43
    private static final String[] ARGS1 = new String[] {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    44
        "-d", OUTPUT_DIR + "-1", "-tagletpath",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 21500
diff changeset
    45
        SRC_DIR, "-taglet", "taglets.CustomTag",
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 21500
diff changeset
    46
        "-sourcepath", SRC_DIR, SRC_DIR + "/TagTestClass.java"
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    47
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    48
    private static final String[] ARGS2 = new String[] {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    49
        "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-sourcepath",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 21500
diff changeset
    50
        SRC_DIR, SRC_DIR + "/TagTestClass.java"
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    51
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    52
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    53
    private static final String[] ARGS3 = new String[] {
24072
e7549dcbc4af 8040903: Clean up use of BUG_ID in javadoc tests
jjg
parents: 24065
diff changeset
    54
        "-d", OUTPUT_DIR + "-3", "-sourcepath",
23971
f5ff1f5a8dee 8031649: Clean up javadoc tests
jjg
parents: 21500
diff changeset
    55
        SRC_DIR, SRC_DIR + "/TagTestClass.java"
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    56
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    57
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    58
    //Input for string search tests.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    59
    private static final String[][] TEST = new String[][] {
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    60
        {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    61
        }
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    62
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    63
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    64
    private static final String[][] TEST1 = new String[][] {
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    65
        {ERROR_OUTPUT, "error: unknown tag: unknownTag"
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    66
        }
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    67
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    68
    private static final String[][] TEST2 = new String[][] {
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    69
        {WARNING_OUTPUT, "warning - @customTag is an unknown tag."
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    70
        },
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    71
        {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    72
        }
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    73
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    74
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    75
    private static final String[][] TEST3 = new String[][] {
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    76
        {ERROR_OUTPUT, "error: unknown tag: customTag"
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    77
        },
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    78
        {ERROR_OUTPUT, "error: unknown tag: unknownTag"
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    79
        }
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    80
    };
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    81
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    82
    /**
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    83
     * The entry point of the test.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    84
     * @param args the array of command line arguments.
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    85
     */
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    86
    public static void main(String[] args) {
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    87
        TestCustomTag tester = new TestCustomTag();
24065
fc4022e50129 8041150: Avoid silly use of static methods in JavadocTester
jjg
parents: 23971
diff changeset
    88
        tester.run(ARGS, TEST, NO_TEST);
fc4022e50129 8041150: Avoid silly use of static methods in JavadocTester
jjg
parents: 23971
diff changeset
    89
        tester.run(ARGS1, TEST1, NO_TEST);
fc4022e50129 8041150: Avoid silly use of static methods in JavadocTester
jjg
parents: 23971
diff changeset
    90
        tester.run(ARGS2, TEST2, NO_TEST);
fc4022e50129 8041150: Avoid silly use of static methods in JavadocTester
jjg
parents: 23971
diff changeset
    91
        tester.run(ARGS3, TEST3, NO_TEST);
21500
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    92
        tester.printSummary();
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    93
    }
475e59d3b40c 8006248: Since addition of -Xdoclint, javadoc ignores unknown tags
bpatel
parents:
diff changeset
    94
}