langtools/test/tools/doclint/CoverageExtras.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 15370 c1c9a9e11b26
permissions -rw-r--r--
8076543: Add @modules as needed to the langtools tests Reviewed-by: jjg, shurailine
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15370
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 15370
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
15370
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     4
 *
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     8
 *
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    13
 * accompanied this code).
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    14
 *
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    18
 *
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    21
 * questions.
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    22
 */
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    23
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    24
/**
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    25
 * @test
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    26
 * @bug 8006263
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    27
 * @summary Supplementary test cases needed for doclint
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 15370
diff changeset
    28
 * @modules jdk.compiler/com.sun.tools.doclint
15370
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    29
 */
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    30
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    31
import com.sun.tools.doclint.Checker;
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    32
import com.sun.tools.doclint.Entity;
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    33
import com.sun.tools.doclint.HtmlTag;
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    34
import com.sun.tools.doclint.Messages;
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    35
import java.util.Objects;
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    36
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    37
public class CoverageExtras {
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    38
    public static void main(String... args) {
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    39
        new CoverageExtras().run();
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    40
    }
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    41
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    42
    void run() {
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    43
        check(HtmlTag.A, HtmlTag.valueOf("A"), HtmlTag.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    44
        check(HtmlTag.Attr.ABBR, HtmlTag.Attr.valueOf("ABBR"), HtmlTag.Attr.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    45
        check(HtmlTag.AttrKind.INVALID, HtmlTag.AttrKind.valueOf("INVALID"), HtmlTag.AttrKind.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    46
        check(HtmlTag.BlockType.BLOCK, HtmlTag.BlockType.valueOf("BLOCK"), HtmlTag.BlockType.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    47
        check(HtmlTag.EndKind.NONE, HtmlTag.EndKind.valueOf("NONE"), HtmlTag.EndKind.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    48
        check(HtmlTag.Flag.EXPECT_CONTENT, HtmlTag.Flag.valueOf("EXPECT_CONTENT"), HtmlTag.Flag.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    49
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    50
        check(Checker.Flag.TABLE_HAS_CAPTION, Checker.Flag.valueOf("TABLE_HAS_CAPTION"), Checker.Flag.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    51
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    52
        check(Entity.nbsp, Entity.valueOf("nbsp"), Entity.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    53
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    54
        check(Messages.Group.ACCESSIBILITY, Messages.Group.valueOf("ACCESSIBILITY"), Messages.Group.values());
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    55
    }
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    56
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    57
    <T extends Enum<T>> void check(T expect, T value, T[] values) {
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    58
        if (!Objects.equals(expect, value)) {
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    59
            error("Mismatch: '" + expect + "', '" + value + "'");
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    60
        }
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    61
        if (!Objects.equals(expect, values[0])) {
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    62
            error("Mismatch: '" + expect + "', '" + values[0] + "'");
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    63
        }
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    64
    }
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    65
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    66
    void error(String msg) {
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    67
        System.err.println("Error: " + msg);
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    68
        errors++;
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    69
    }
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    70
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    71
    int errors;
c1c9a9e11b26 8006263: Supplementary test cases needed for doclint
jjg
parents:
diff changeset
    72
}