Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/tools/doclint/CoverageExtras.java
32285 views
1
/*
2
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
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
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/**
25
* @test
26
* @bug 8006263
27
* @summary Supplementary test cases needed for doclint
28
*/
29
30
import com.sun.tools.doclint.Checker;
31
import com.sun.tools.doclint.Entity;
32
import com.sun.tools.doclint.HtmlTag;
33
import com.sun.tools.doclint.Messages;
34
import java.util.Objects;
35
36
public class CoverageExtras {
37
public static void main(String... args) {
38
new CoverageExtras().run();
39
}
40
41
void run() {
42
check(HtmlTag.A, HtmlTag.valueOf("A"), HtmlTag.values());
43
check(HtmlTag.Attr.ABBR, HtmlTag.Attr.valueOf("ABBR"), HtmlTag.Attr.values());
44
check(HtmlTag.AttrKind.INVALID, HtmlTag.AttrKind.valueOf("INVALID"), HtmlTag.AttrKind.values());
45
check(HtmlTag.BlockType.BLOCK, HtmlTag.BlockType.valueOf("BLOCK"), HtmlTag.BlockType.values());
46
check(HtmlTag.EndKind.NONE, HtmlTag.EndKind.valueOf("NONE"), HtmlTag.EndKind.values());
47
check(HtmlTag.Flag.EXPECT_CONTENT, HtmlTag.Flag.valueOf("EXPECT_CONTENT"), HtmlTag.Flag.values());
48
49
check(Checker.Flag.TABLE_HAS_CAPTION, Checker.Flag.valueOf("TABLE_HAS_CAPTION"), Checker.Flag.values());
50
51
check(Entity.nbsp, Entity.valueOf("nbsp"), Entity.values());
52
53
check(Messages.Group.ACCESSIBILITY, Messages.Group.valueOf("ACCESSIBILITY"), Messages.Group.values());
54
}
55
56
<T extends Enum<T>> void check(T expect, T value, T[] values) {
57
if (!Objects.equals(expect, value)) {
58
error("Mismatch: '" + expect + "', '" + value + "'");
59
}
60
if (!Objects.equals(expect, values[0])) {
61
error("Mismatch: '" + expect + "', '" + values[0] + "'");
62
}
63
}
64
65
void error(String msg) {
66
System.err.println("Error: " + msg);
67
errors++;
68
}
69
70
int errors;
71
}
72
73