Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/tools/doclint/CoverageExtras.java
41145 views
1
/*
2
* Copyright (c) 2013, 2020, 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
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
29
*/
30
31
import java.util.Objects;
32
33
import jdk.javadoc.internal.doclint.Checker;
34
import jdk.javadoc.internal.doclint.HtmlTag;
35
import jdk.javadoc.internal.doclint.Messages;
36
37
public class CoverageExtras {
38
public static void main(String... args) {
39
new CoverageExtras().run();
40
}
41
42
void run() {
43
check(HtmlTag.A, HtmlTag.valueOf("A"), HtmlTag.values());
44
check(HtmlTag.Attr.ABBR, HtmlTag.Attr.valueOf("ABBR"), HtmlTag.Attr.values());
45
check(HtmlTag.AttrKind.INVALID, HtmlTag.AttrKind.valueOf("INVALID"), HtmlTag.AttrKind.values());
46
check(HtmlTag.BlockType.BLOCK, HtmlTag.BlockType.valueOf("BLOCK"), HtmlTag.BlockType.values());
47
check(HtmlTag.EndKind.NONE, HtmlTag.EndKind.valueOf("NONE"), HtmlTag.EndKind.values());
48
check(HtmlTag.Flag.EXPECT_CONTENT, HtmlTag.Flag.valueOf("EXPECT_CONTENT"), HtmlTag.Flag.values());
49
50
check(Checker.Flag.TABLE_HAS_CAPTION, Checker.Flag.valueOf("TABLE_HAS_CAPTION"), Checker.Flag.values());
51
52
check(Messages.Group.ACCESSIBILITY, Messages.Group.valueOf("ACCESSIBILITY"), Messages.Group.values());
53
}
54
55
<T extends Enum<T>> void check(T expect, T value, T[] values) {
56
if (!Objects.equals(expect, value)) {
57
error("Mismatch: '" + expect + "', '" + value + "'");
58
}
59
if (!Objects.equals(expect, values[0])) {
60
error("Mismatch: '" + expect + "', '" + values[0] + "'");
61
}
62
}
63
64
void error(String msg) {
65
System.err.println("Error: " + msg);
66
errors++;
67
}
68
69
int errors;
70
}
71
72