Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/tools/doclint/CoverageExtras.java
32285 views
/*1* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 800626326* @summary Supplementary test cases needed for doclint27*/2829import com.sun.tools.doclint.Checker;30import com.sun.tools.doclint.Entity;31import com.sun.tools.doclint.HtmlTag;32import com.sun.tools.doclint.Messages;33import java.util.Objects;3435public class CoverageExtras {36public static void main(String... args) {37new CoverageExtras().run();38}3940void run() {41check(HtmlTag.A, HtmlTag.valueOf("A"), HtmlTag.values());42check(HtmlTag.Attr.ABBR, HtmlTag.Attr.valueOf("ABBR"), HtmlTag.Attr.values());43check(HtmlTag.AttrKind.INVALID, HtmlTag.AttrKind.valueOf("INVALID"), HtmlTag.AttrKind.values());44check(HtmlTag.BlockType.BLOCK, HtmlTag.BlockType.valueOf("BLOCK"), HtmlTag.BlockType.values());45check(HtmlTag.EndKind.NONE, HtmlTag.EndKind.valueOf("NONE"), HtmlTag.EndKind.values());46check(HtmlTag.Flag.EXPECT_CONTENT, HtmlTag.Flag.valueOf("EXPECT_CONTENT"), HtmlTag.Flag.values());4748check(Checker.Flag.TABLE_HAS_CAPTION, Checker.Flag.valueOf("TABLE_HAS_CAPTION"), Checker.Flag.values());4950check(Entity.nbsp, Entity.valueOf("nbsp"), Entity.values());5152check(Messages.Group.ACCESSIBILITY, Messages.Group.valueOf("ACCESSIBILITY"), Messages.Group.values());53}5455<T extends Enum<T>> void check(T expect, T value, T[] values) {56if (!Objects.equals(expect, value)) {57error("Mismatch: '" + expect + "', '" + value + "'");58}59if (!Objects.equals(expect, values[0])) {60error("Mismatch: '" + expect + "', '" + values[0] + "'");61}62}6364void error(String msg) {65System.err.println("Error: " + msg);66errors++;67}6869int errors;70}717273